Ball Trajectory Simulator
Simulate ball trajectories with adjustable gravity, air drag, wind, bounce, and launch parameters. Real physics engine with Euler integration.
About
Projectile motion calculations without air resistance are trivial. Real trajectories diverge significantly from the parabolic ideal due to quadratic drag force proportional to v2. A baseball launched at 45° with initial speed 40 m/s lands roughly 30% shorter than the vacuum prediction. This simulator uses Euler numerical integration to solve the coupled differential equations of motion frame-by-frame, applying gravitational acceleration g, quadratic aerodynamic drag with coefficient Cd, and optional constant wind force. Bounce collisions apply a coefficient of restitution e that removes kinetic energy each impact. The tool assumes a spherical projectile, sea-level air density ρ = 1.225 kg/m3, and no spin (Magnus effect is excluded). Approximation error scales with timestep size. Results are visual estimates, not engineering-grade predictions.
Formulas
The net force on the projectile is the vector sum of gravity, aerodynamic drag, and wind. At each timestep Δt, position and velocity are updated via forward Euler integration.
Where the cross-sectional area is:
Velocity update per timestep:
Position update:
On ground collision (y ≤ 0), the vertical velocity component is reversed and scaled by the coefficient of restitution:
Where m = mass, Cd = drag coefficient, ρ = air density, A = cross-sectional area, r = ball radius, e = coefficient of restitution, v = unit velocity vector. Wind adds a constant horizontal acceleration aw independent of ball velocity.
Reference Data
| Parameter | Symbol | Default | Typical Range | Notes |
|---|---|---|---|---|
| Gravitational Acceleration | g | 9.81 m/s2 | 1.62 - 24.79 | Moon: 1.62, Jupiter: 24.79 |
| Drag Coefficient (Sphere) | Cd | 0.47 | 0.1 - 1.2 | Smooth sphere at Re > 103 |
| Air Density (Sea Level) | ρ | 1.225 kg/m3 | 0.0 - 1.5 | Set 0 for vacuum |
| Ball Mass | m | 0.145 kg | 0.01 - 10 | Baseball: 0.145, Soccer: 0.43 |
| Ball Radius | r | 0.037 m | 0.01 - 0.5 | Cross-section A = πr2 |
| Coefficient of Restitution | e | 0.7 | 0.0 - 1.0 | 1.0 = perfectly elastic |
| Launch Angle | θ | 45° | 0 - 90 | Optimal vacuum range at 45° |
| Launch Speed | v0 | 25 m/s | 1 - 100 | MLB pitch: ~40 m/s |
| Launch Height | h0 | 1 m | 0 - 50 | Height above ground plane |
| Wind Speed | vw | 0 m/s | −30 - 30 | Positive = tailwind, Negative = headwind |
| Timestep | Δt | 0.002 s | 0.001 - 0.01 | Smaller = more accurate, slower |
| Tennis Ball Cd | - | 0.55 | - | Fuzzy surface increases drag |
| Golf Ball Cd | - | 0.25 | - | Dimples reduce drag via turbulent boundary layer |
| Basketball Cd | - | 0.47 | - | Standard smooth sphere approximation |
| Ping Pong Ball | - | 0.50 | - | Mass: 0.0027 kg, very drag-sensitive |
| Mars Gravity | g | 3.72 m/s2 | - | Thin atmosphere: ρ ≈ 0.020 |