# Fire projectile in front of target rather than at target

This topic is 1655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys,

I'm having a slight issue in calculating the speed and vector of a projectile to ensure it will always hit a moving target.

Assuming all speeds are constant, with only and x and y axis, and are moving in meters per second:

If I fire a projectile at my enemy, at a speed of 10m/s, that is 20 meters away and the enemy is moving in a straight line at 10m/s.... how can I find the projectile's moving vector to ensure that the projectile and the enemy meet at the same point?

I hope it makes sense, let me know if anyone needs anymore explanation.

Thanks for any help!

Hello.

##### Share on other sites

Oh great, thanks a lot! That's exactly what I needed.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634089
• Total Posts
3015458
×