Aiming a turret at the mouse

Started by
0 comments, last by fitfool 15 years, 4 months ago
So I understand the math behind getting my turret to aim at the mouse. Take the vector between the rotating point of the turret and the mouse, and the vector between the rotating point and the tip of the turret, normalize them, and take the dot product. Then use acos of that number to get the angle in radians. I then use that angle (converted to degrees) to give to openGL to rotate the quad. The issue I'm having is keeping track of the vector from the rotating point to the end of the turret. After openGL does the first rotation I no longer know the x and y coordinates of that point. Should I do the rotation myself, or is there a better way of doing this than what I'm thinking? [Edited by - PlutoWarrior on November 28, 2008 12:25:29 PM]
---------------------------------------------Warning: This post may contain traces of Q-Basic
Advertisement
atan2()

This topic is closed to new replies.

Advertisement