Can't get rotation correct.

JaystaJaysta Member Posts: 18
edited October 2012 in Working with GS (Mac)
Hi,

Im having trouble with rotation. Image is facing right.

I have an enemy tank and friendly tank with with position X,Y constrained to ER Pos X,Y and friendly tank X,Y.

Now, enemy tank comes randomly from bottom of screen, and friendly tank spawns from tank factory any where on screen where user places the tank factory.

I have friendly tank set to move to: ER Pos X,Y and self.rotation constrained to vectorToAngle( game.ER Pos X , game.ER Pos Y ) but it does not rotate to face enemy tank.

Is there something I am missing?

Screen is 960x640, tracking area is half the size, so user can move around the world.

Thanks.

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited October 2012
    Try constraining the tanks rotation to vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y )

    Darren.
  • JaystaJaysta Member Posts: 18
    Ha thanks, pretty simple eh.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Glad you got it working :)

    Darren.
Sign In or Register to comment.