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
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!