

For a video of the result, scroll down to the bottom.īefore we tackle this problem let's consider a more simple example: hitting a stationary target. In this article I present a method of calculating where to aim your weapon which fires a projectile under simple gravity to hit an arbitrary moving target in 3D space. Without this hack projectiles are either pathethic or need a very high velocity to compensate. The resulting trajectory is a ballistic trajectory.īecause gravity is a harsh mistress literally every game 'cheats' this and fakes a much lower gravity constant for projectiles than is used for players. The games I play come with simple ballistic physics for projectile-based weapons: the projectiles are fired with an initial speed and are only affected by gravity.

Projectile Solver Hitting a moving target with a ballistic projectile
