Expand description
Simple launch velocity calculation for game projectiles
to hit a specified target based on given gravity. Only
depending on bevy_math
for vector math.
Based on this article by Forrest Smith
Functionsยง
- ballistic_
range - Caluculate range of a projectile being fired from
initial_height
withspeed
and only affected bygravity
. - launch_
velocity - Calculates a
low
andhigh
angle for projectile to start atstart_pos
to hittarget_pos
with a giveninitial_velocity
. - launch_
velocity_ lateral - Solve for arc with a fixed lateral speed. Vertical speed and gravity varies. This leads to a visually pleasing arc.
- launch_
velocity_ lateral_ moving_ target - launch_
velocity_ moving_ target