Hey guys. I've been working on this 3d sidescrollr and managed to get the character flipping properly based on which way hes moving, but the problem is that if he runs towards the left, he will face left, but run right. Any help here?
var walkSpeed = 30;
function Update () {
if(grounded) {
moveDirection = new Vector3(0,0,Input.GetAxis("Horizontal"));
transform.LookAt(transform.position + moveDirection);
if(isMoveable == true){
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= walkSpeed;
moveStatus = "idle";
}
if(moveDirection != Vector3.zero && isMoveable == true) {
animation.CrossFade("run",0.2);
isMoving = true;
} else {
isMoving = false;
animation.CrossFade("Take 001",0.2);
}
}
Thanks a ton dude! Works Perfectly!
– XatokuWow! Used so many hours trying to figure this one out as well, and it was all a matter of removing one single line. Damn... Thanks!
– A_Digital_Goodie