## Angry Birds

### Activity Information

#### Learning Goals

- Model a projectile ( HS-PS2-1)
- Be able to determine launch angle and velocity given target location

#### Prior Knowledge Required

- Trigonometry
- Decomposing vectors
- Kinematics in 2-Dimensions

#### Code Manipulation

- Modify existing code
- Translate physical quantities and equations into code

—-

### Activity

#### Handout

** Angry Birds **

You have set up your Angry Bird catapult 250 m away from a pig encampment in order to destroy them. The encampment is here on Earth. You are to ignore the effects of air friction in your calculations and computer simulation.

##### Pre-Coding Questions

- Select an initial velocity for your Angry Bird in order to obliterate the encapment. Using this velocity, determine the angle of elevation required to hit the pig encampment, thus destroying those scoundrels!
- Now determine the horizontal and vertical components of the velocity based on your calculated angle.
- Now imagine that you locate another pig encampment that is directly above the one you have destroyed. If it's 52 m directly above the first encampment, determine the necessary velocity and angle of elevation to hit and destroy this one.

##### Post-Coding Questions

- Using the minimally working code (below), modify it such that it fits the initial scenario.
- Adjust this code so that it fits the second scenario

#### Code

GlowScript 3.0 VPython floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) crate1 = box(pos=vector(-145,7,0), size=vector(10,10,3), color=color.blue) crate2 = box(pos=vector(140,10,0), size=vector(20,20,5), color=color.red) #Setting the time interval t=0 dt=0.01 crate1v=vector(25,5,0) while crate2.pos.x-crate1.pos.x>20: rate(250) crate1.pos=crate1.pos+crate1v*dt t=t+dt

### Answer Key

#### Handout

##### Pre-Coding Solutions

- In order to approach this problem, we can start by trying to solve the following system of equations that describes simple projectile motion: $$x=x_0+v_x*t$$ $$y=y_0+v_y*t+\dfrac{1}{2}g*t^2$$ where $x$ and $y$ are the horizontal and vertical positions of the bird, $v_x$ and $v_y$ are the horizontal and vertical components of the bird's velocity, $t$ is time, and $g$ is the acceleration due to gravity (-9.8 m/s/s). Assuming the initial position is at the origin, we know the final location ($x=250$ and $y=0$). In order to ensure the birds can actually hit the pig encampment, the magnitude of their velocity must be sufficiently high; we'll choose 50 m/s. We don't, however, know the horizontal or vertical components of this velocity, so we will have to make a substitution. Using trigonometry, we find that $v_x=50\cos(\theta)$ and $v_y=50\sin(\theta)$. Substituting what we know back into the original system of equations, we can solve for t, and subsequently find the initial launch angle: $$250=0+50\cos(\theta)t$$ $$0=0+50\sin(\theta)-\dfrac{9.8}{2}$$ Using an online calculator, we find that $t=6.46$ s and $\theta=39.3$°.
- Now that we know the angle, we can find our horizontal and vertical components of velocity by simply plugging $\theta$ into the two substitutions above: $v_x=50\cos(39.3°)=38.7$ m/s and $v_y=50\sin(39.3°)=31.6$ m/s.
- The process for figuring out how to hit the second encampment 52 m above the first one is relatively similar, with two key differences. Firstly, we need to increase the sling-shot speed; at 50 m/s, no matter what angle you aim the bird, it will never reach the encampment. Increasing it to 75 m/s should be sufficient. Secondly, we need to adjust the $y$ in the system of equations from 0 to 52 to model the elevation difference between the two encampments. With these changes, we can follow the process detailed in part 1 & 2. We find that $\theta=25.4°$, $v_x=67.7$ m/s, and $v_y=32.2$ m/s.

##### Post-Coding Solutions

See highlighted code below:

#### Code

##### Scenario 1

GlowScript 3.0 VPython floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) crate1 = box(pos=vector(-145,10,0), size=vector(10,10,3), color=color.blue) crate2 = box(pos=vector(105,10,0), size=vector(20,20,5), color=color.red) #Setting the time interval t=0 dt=0.01 crate1v=vector(38.7,31.6,0) crate1a=vector(0,-9.8,0) while crate2.pos.x-crate1.pos.x>10: rate(250) crate1.pos=crate1.pos+crate1v*dt crate1v=crate1v+crate1a*dt t=t+dt

##### Scenario 2

GlowScript 3.0 VPython floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) crate1 = box(pos=vector(-145,10,0), size=vector(10,10,3), color=color.blue) crate2 = box(pos=vector(105,62,0), size=vector(20,20,5), color=color.red) #Setting the time interval t=0 dt=0.01 crate1v=vector(67.7,32.2,0) crate1a=vector(0,-9.8,0) while crate2.pos.x-crate1.pos.x>10: rate(200) crate1.pos=crate1.pos+crate1v*dt crate1v=crate1v+crate1a*dt t=t+dt