Can you detect the movement of the left and right How can it?

Sorry for my poor English.

Already, I have to move freely in the virtual keyboard players.

I’m locked on in “transform.LookAt(enemy);”, Targetting…

var enemy : Transform ;
function FixedUpdate () {

In this state, I want to detect if the player is moved to the left or right, or has moved to either.

However, as the image is an overhead view.

The reason for this is if you move to the left, because you want to assign in the “mecanim” individual animations that are walking to the left.

How do you do it can be detected?


I is likely to be used to go etc., “Vector3.Dot” try a few times,
I’m not sure.

(in the)
function FixedUpdate () {

newpos = thisTransform.forward;
var Dot = Vector3.Dot(newpos,prevpos);
Debug.Log("Dot =" + Dot);
prevpos = thisTransform.forward;

Take a look at SignedDotProduct() method in the Math3D script. I’ve never used it, but here is the comment with the method:

//This function calculates a signed (+ or - sign instead of being ambiguous) dot product. It is basically used
//to figure out whether a vector is positioned to the left or right of another vector. The way this is done is
//by calculating a vector perpendicular to one of the vectors and using that as a reference. This is because
//the result of a dot product only has signed information when an angle is transitioning between more or less
//then 90 degrees.