Auto rotate

BeanstineBeanstine Member Posts: 101
edited December 2011 in Working with GS (Mac)
How do you make an actor automatically rotate to a spot. like it would rotate to follow the mouse or touch?

Comments

  • ozboybrianozboybrian PRO Posts: 2,102
    Create Rule.

    When touch is pressed.
    Behaviour - Rotate.

    Simple :D hope that helps.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You could use the 'Rotate to Position' Behavior. Then you can put the x and y coordinates of the position you want it to rotate/point to (like mouse.position.X and mouse.position.y).

    Hope this helps!
    RThurman
  • BeanstineBeanstine Member Posts: 101
    how will i tell the actor how far to rotate? i want it to be where i can move the mouse around an actor an it'll rotate so that it faces the mouse
  • BeanstineBeanstine Member Posts: 101
    ok didn't see ur post RThurman before i posted. thanks
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Rotate to Position will do that. (But you would need to put it inside a timer that fires 20 to 30 times a second.)

    The other way is to use a constrain attribute behavior:
    Constrain Attribute: self.Rotation To: VectorToAngle(vectorToAngle(game.Mouse.Position.X-self.Position.X, game.Mouse.Position.Y-self.Position.Y)

    You build the expression in the expression editor using the drop down menus. (You can't simply copy and paste that expression.)

    Hope this helps!
    RThurman
Sign In or Register to comment.