GameSalad

WASD movement not working with rotate to mouse behaviour

justinodunnjustinodunn Posts: 226Member, PRO

So my code is vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )-90, to have my character rotate towards my mouse. I have change velocity behaviours assigned to the WASD keys so that the character can move. However, the movement is stuck when I hold down the key and as I rotate my mouse to look somewhere else, the actor keeps moving towards the original direction. How do I fix this? I've attached the file in this post to give a better idea. Thanks!

Comments

  • RThurmanRThurman Posts: 2,697Member, Sous Chef, PRO

    You will probably want to use the "Move" behavior rather than those "Change Velocity" actions.

    "Change Velocity" is an action (with a big red "A"). This means it just fires once. It gives a quick impulse of velocity. It is like a bullet.

    "Move" is a persistent behavior (with a big green "B"). This means it constantly fires and updates. It is like a self guided missile.

Sign In or Register to comment.