I have a game where I know the location and velocity of my target. I know my own location and the speed of my projectile. I want to determine either
the location of the intersection between my projectile fired and the target, or
the time taken for my projectile to intersect the target
All entities are travelling with constant speed and direction which makes life easier. I have been trying to work out the maths for some time but cannot quite get it right. I know that the predicted location of the target intersecting the projectile will be
Pp = Tp + Tv * t
Where Pp is the predicted position, Tp is the current target position, Tv is the target velocity, and t is time.
I also know that
t = |Pp - Sp| / Bs
where Sp is my (source) position and Fs is the projectile (bullet) speed. But I cannot figure out a way to solve this to get either Pp or t.
I know that all speeds are constant. I am free to aim in any direction and I know that the projectile is faster than the target therefore a hit is guaranteed
Can anyone enlighten me? Thanks
I found a website detailing one method but this doesnt seem to work (http://howlingmoonsoftware.com/wordpress/leading-a-target/). My verification method to determine if it worked was to use the predicted position to determine the time for the target to reach it, and for the projectile to reach it. These should be very similar but in my game they are out by almost a factor of 2.