I want to control my character with input key,for example i wanna run my character when i press the w button,for this i add a run animation to my character and i write a simple script code but when i run the project Ethan(my character) doesnt move or doesnt idle,nothing happens,can anyone help?
public Rigidbody rb;
public float thrust;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody> ();
}
// Update is called once per frame
void Update () {
rb.AddForce (transform.forward * thrust);
if (Input.GetKeyDown ("w")) {
GetComponent<Animation>().Play("HumanoidRun");
}