# 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
1. 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!
2. Now determine the horizontal and vertical components of the velocity based on your calculated angle.
3. 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
1. Using the minimally working code (below), modify it such that it fits the initial scenario.
2. 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 ``````

Handout

##### Pre-Coding Solutions
1. In order to approach this problem, we can start by trying to solve the following system of equations that describes simple projectile motion:

x=x0+vx∗t y=y0+v

y∗t+12g∗t2

where x and y are the horizontal and vertical positions of the bird, vx and vy 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 vx=50cos(θ) and vy=50sin(θ). 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+50cos(θ)t

0=0+50sin(θ)−9.82

Using an online calculator, we find that t=6.46 s and θ=39.3°.

1. Now that we know the angle, we can find our horizontal and vertical components of velocity by simply plugging θ into the two substitutions above: vx=50cos(39.3°)=38.7 m/s and vy=50sin(39.3°)=31.6 m/s.
2. 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 θ=25.4°, vx=67.7 m/s, and vy=32.2 m/s.

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 ``````