The horizontal distance traveled by the ball can be calculated as The maximum elevation of the ball can be calculated as The time for the ball to reach maximum level is S = flight distance (m, ft) Example - Throwing a BallĪ ball is thrown with initial velocity 25 m/s in angle 30 degrees to the horizontal plane. The horizontal distance of the flight can be expressed as The maximum elevation - h - of the flight can be calculated as The total flight time can be expressed as Θ = the initial angle of the velocity vector to the horizontal plane (degrees)Ī g = acceleration of gravity (9.81 m/s 2, 32.174 ft/s 2) V i = initial velocity of the projectile (m/s, ft/s) (On planet Earth: g = 9.The time for a projectile - a bullet, a ball or a stone or something similar - thrown out with an angle Θ to the horizontal plane - to reach the maximum height can be calculated as
represents the “delta”: the amount of time (milliseconds) between two frames.To do so we will use the following formulas: Can you think of any other video games based on this formula? Alternative ApproachĪn alternative approach to implement this projectile motion formula to a flying object/sprite/ball using a frame based animation is to recalculate the position and velocity vector of the sprite at frame n+1 based at on its position and velocity at frame n: Let’s apply these formula using a Python script using the processing library to create a frame based animation.Īngry Birds, Tanks, Worms, Sports/Ball based games (Basketball…) all use a similar algorithm and formula. The number of frames since the object has been thrown can be used as a frame based game display a frame every x milliseconds.) represents the time in seconds since the object was thrown.(At what angle was the projectile thrown) (theta) represents the angle of projection.represents the initial velocity, in other words the initial power/speed that was used to shoot/throw the projectile,.Using the displacement formula we can calculate the position ((x,y) coordinates) of a projectile at any given time. This page helped us with defining the equation for the trajectory of the projectile: use a value between 0 and 90 degrees) or the velocity. Use the script below and see what happens when you change the angle. Due to gravity, its trajectory will be a parabola which shape will vary based on the angle and initial velocity of the projectile. Most artillery games are based on the Projectile Motion Formula used to trace the trajectory of a projectile thrown in the air.