How to calculate shot angle and velocity to hit a moving target?
Posted
by
Guen
on Game Development
See other posts from Game Development
or by Guen
Published on 2012-03-09T21:07:30Z
Indexed on
2012/10/02
21:54 UTC
Read the original article
Hit count: 150
I am developing a 2D Android game and I am making an aiming algorithm for AI projectiles to hit enemies either following a path, or free moving. At the moment it just calculates where the target will be after a distance and fires a projectile to meet it at that distance. Of course this means varying the projectile speed to meet the target.
Does anyone have any tips for a simple-ish algorithm (optimal-ish) to calculate when the projectile needs to fire and where it needs to aim if it can only travel at a constant velocity? Say the projectile goes twice the speed of the target?
The only way I can think of involves searching and seems quite large.
© Game Development or respective owner