Move the rigidbody with keys

I’m sorry that this is probably an idiotic question, but I just can’t find the mistake!
Here is a small script which should allow the player to move with key inputs.

void Update(){  
    Vector3 movedir = new Vector3(Input.GetAxis ("Horizontal"),0, Input.GetAxis ("Vertical"));  
    print (movedir);  
    rigidbody.AddForce (movedir);  
}

But it dosen’t work! :frowning:

It does work :slight_smile: the problem is you are applying a very small amount of force. Try multiplying the movedir by an amount to apply a greater amount of force :

public float forceAmount = 200f;

void Update(){  
    Vector3 movedir = new Vector3(Input.GetAxis ("Horizontal"),0, Input.GetAxis ("Vertical"));  
    print (movedir);  
    rigidbody.AddForce (movedir*forceAmount);  
}

in future, please format your code by highlighting the code and clicking the 101010 button