# How to calculate an intercept course?

**URL:** <https://forum.kirupa.com/t/how-to-calculate-an-intercept-course/208681>\
**Category:** flash\
**Created:** [December 1, 2006, 4:39am UTC](https://forum.kirupa.com/t/how-to-calculate-an-intercept-course/208681 "2006-12-01T04:39:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TOdorus](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/todorus/32/3037_2.png) [@TOdorus](https://forum.kirupa.com/u/TOdorus)\
**Post date:** [December 1, 2006, 4:39am UTC](https://forum.kirupa.com/t/how-to-calculate-an-intercept-course/208681/1 "2006-12-01T04:39:22Z")

</div>

Hi all, I’ve been trying to crack this problem for more than two days now, and it’s starting to frustrate me.

Here’s the situation. I’m working on a game which will involve space battles, and automated turrets. The turrets are giving me the headache right now. Here’s what I got so far.

[http://home.planet.nl/~bogaa096/Starfight/Alpha22.html](http://home.planet.nl/%7Ebogaa096/Starfight/Alpha22.html)

The problem is, that the turrets aim at the center of their target, instead of aiming in front of their target to compensate for their movement. I can’t seem to crack the equations needed to get the right rotation, for the turret to fire from.

The data the turret has avaible, or that I could easily make avaible to it, are:

- The distance to the target (and it’s x and y components)
- The current speed vector (the size and rotation)
- The angle between the heading of the target and the turret’s location
- The speed of the turret’s shot (fixed speed)

If anyone here could help, I’d much aprecciate it!
