Top Down 2D Character Facing Animation Problems
So thanks to some online video tutorials I managed to make a top down 2D AI Follow script. I figured that, modification of the script The only problem is, I'm trying to modify values of the script slightly to also enable the animator to modify the values of 'LASTMOVED(X/Y)'. I'm not sure what to do to this script exactly, but I'm pretty sure it's this excerpt that needs to be fixed;
if (Vector3.Distance(target.position, transform.position) <= ChaseRadius && Vector3.Distance(target.position, transform.position) > MinimumChaseRadius)
{
Vector3 temp = Vector3.MoveTowards(transform.position, target.position, MoveSpeed * 0);
changeAnim(temp - transform.position);
}
I know that MoveTowards() is the wrong eval for this type of equation but I can't seem to find a better substitute without running into compiler errors and the like.. I tried doing this with Distance() only but that only seems to accept floats so I can't use 'temp' anymore, which is what the vector 2 maths equations read.
And for frame of reference I'll post the full script in its entirety down below as a comment.