Car turorial reset vehicle

Hi all!

I'm working on a test game with the car turorial, but I've got a little problem. When my car jumps over a ramp and flips, it doesn't have a way to reset itself. I created a new statement in the CarController:

if (Input.GetKeyDown(KeyCode.F))
            drivetrain.ResetCar ();

And this void in the drivetrain:

public void ResetCar ()


But now I'm lost. How can I make the car rise 3 meters and reset it's roll?

you can lock its rotation if it's a rigid body under rigidbody ~> constraints ~> freeze rotation.


in your ResetCar function you can put a transform.rotation feature in there to reset it back to it's normal way up

Well assuming your car steers left and right around the Y axis, to reset its roll/pitch you need to reset only the X and Z axes.

On your car script, store the car's original rotation transform into a variable.


private float _originalRotX;
private float _originalRotZ;

    void Start () {
        _originalRotX = transform.rotation.x;
        _originalRotZ = transform.rotation.z;

    void ResetCar()
            // Move the rigidbody up by 3 metres
            transform.Translate(0, 3, 0);
            // Reset the rotation to what it was when the car was initialized
            transform.rotation = (Quaternion.Euler(new Vector3(_originalRotX, transform.rotation.y, _originalRotZ)));