I am using a very simple script for movement and a fixed camera that’s almost top down. I have searched all over for a way to make my character face the way he is moving but nothing seems to work with my script. Am I going to have to find another way to write the movements?
here is what I am using:
var speed:int = 10; var gravity = 10;
private var cc:CharacterController;
function Start(){
cc = GetComponent(CharacterController);
}
function Update(){
cc.Move(Vector3(Input.GetAxis("Horizontal")
* speed * Time.deltaTime, -gravity * Time.deltaTime,
Input.GetAxis("Vertical") * speed *
Time.deltaTime));
if (Input.GetAxis("Vertical") > 0.2)
animation.CrossFade ("run");
if (Input.GetAxis("Horizontal") > 0.2)
animation.CrossFade ("run");
if (Input.GetAxis("Vertical") < -0.2)
animation.CrossFade ("run");
if (Input.GetAxis("Horizontal") < -0.2)
animation.CrossFade ("run");
if ((Input.GetAxis("Horizontal") < 0.2)
&& (Input.GetAxis("Horizontal") >
-0.2) && (Input.GetAxis("Vertical") < 0.2) && (Input.GetAxis("Vertical") > -0.2))
animation.CrossFade ("Idle");
}