Animating Projectile Motion in Python

Shen Ge
CodeX
Published in
4 min readFeb 27, 2022

--

Projectile motion launched at 50 m/s at an angle of 45 degrees.

Introduction

Projectile motion is a form of motion experienced by an object that is projected near the Earth’s surface and moves along a curved path. This type of motion can also be known as a ballistic trajectory. You encounter it in everyday life in sports such as when someone tries to throw a basketball into a hoop or when you are trying to throw a crumpled piece of paper into the trash can. Launching something from a catapult or shooting a cannonball from a cannon also follow a ballistic trajectory.

Let’s start with some physics and then go into how to create an animation of projectile motion.

Equations of Motion

The equations of motion describe the acceleration, velocity and position in the for both horizontal and vertical motion at every timestep. Projectile motion can be determined completely by the constant acceleration of gravity (g), the launch speed (u) and the launch angle (θ) provided that air friction is negligible. Horizontal and vertical motions are typically separated and described by general equations of motion with this constant acceleration. On Earth, assuming we use metric units and that we are at the surface, gravity (g) is approximated as 9.8 m/s² downwards.

--

--

Shen Ge
CodeX
Writer for

Engineer and console operator who helped America land back on the moon 2/22/2024. Enjoys code + poetry. Become a member: https://medium.com/@shenge86/membership