Hello, im trying to make a controller ,where the sprites are changed based on which direction the player is moving to- but I cant figure out the math and animator settings I need to setup for it to work.
My current problem is when rotating from one to other direction works one way, but when going the other, the values of the angle variable do not stay the same(would be a negative number for example)
Any help would be greatly appreciated!
My current way is this:
Vector2 v = rigid.velocity;
angle = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg;
legAnim.SetFloat("Rotation", angle);
And here is the setup in the animator: