Adding force to rigidbody

I’m trying to make a game which involves flying a rocket. The code I have for the force is:

function Update () {

rigidbody.AddForce(new Vector3(Input.GetAxis("Horizontal") * 2, 0, 0));
rigidbody.AddForce(new Vector3(Input.GetAxis("Vertical") * 5, 0, 0));


The horizontal works, because when the rocket is on the ground I can make it lean with left arrow and right arrow. The vertical, however, doesn’t work as intended. The rocket slides at an angle, and stays on the ground.

Instead of using rigidbody.AddForce, try using rigidbody.AddTorque. AddForce adds a force to the centre of gravity of the rigidbody- which doesn’t change the angle of the object! Use AddTorque to rotate an object the way you want to.

Also, try using transform.TransfomPoint(inputVector) to transform from local coordinates to global coordinates! That way, your inputs will always be the same relative to the position and rotation of the rocket.