How to adjust facing direction of 2D object when using AIPath?

Hi, sorry i think the better question is how do i tell if the game object is moving in which direction so i can make it run the correct animation, e.g. if game object is moving towards west, i will run the move west animation? Is there a variable in AIPath to read from?

Thanks!
Vincent

Hi

You can read the velocity variable.

GetComponent<AIPath>().velocity;

You could also use the desiredVelocity variable depending on which effect you want to achieve.