Help getting a turret to track a crosshair.

I'm working on a tank game.
I have the turret constrined to the base by using a constrin attribute to set the turrets self.positionx and self.positiony to the bases X,Y coordinates with a slight offset to account for the turret offset.

I'm hoping to the have the turret track the mouse movement. I already have a crosshair that follows the mouse by using the constrain cursor X,Y to the mouse X,Y position.

I was trying to utilize RThurman's off center rotation guide to no avail
http://forums.gamesalad.com/discussion/29037/free-yourselves-from-the-tyranny-of-center-only-rotations

Is there an easier way to set up the rotation while keeping the offset?

Base is 44x68, turret is 40x78 so turret is set the tanks centerpoint with an offset of 20 on the Y access to align with the base properly.

Hopefully someone has a suggestion.

Answers

  • ZeroRavenZeroRaven Member Posts: 33
    Well at any rate, I figured out a solution to my problem. Just modified the turret. So now my turrest rotates and tracks the mouse/crosshair, and still remains centered on the tank base.
    Thanks for the views.
Sign In or Register to comment.