So, I've been trying to get my character to look where my mouse cursor is, but it's not working and it's very inconsistent. I'm sorry I don't know how to show video.
Here's the code.
if (CanDirectionChange)
{
Direction.x = Input.GetAxisRaw("Horizontal");
Direction.y = Input.GetAxisRaw("Vertical");
Anim.SetFloat("X", MousePos.x);
Anim.SetFloat("Y", MousePos.y);
Anim.SetFloat("Speed", Direction.sqrMagnitude);
if (MousePos.x>=1 || MousePos.x>=-1 || MousePos.y<=1 || MousePos.y<=-1)
{
Anim.SetFloat("LastX", MousePos.x);
Anim.SetFloat("LastY", MousePos.y);
}
}
The Character looks where the LastX and LastY positions are.
Also the Animator looks like this.
