# Tilting a vehicle on a slope

when going up a hill or ramp ect. the vehicle stays at 90 degre angle doesn't go with the ground, please help!!!

Have you checked the car tutorial?

http://unity3d.com/support/resources/tutorials/car-tutorial

heres the script i use for it, its character controller

var speed = 3.0;

var rotateSpeed = 3.0;

function OnTriggerEnter( hit : Collider )

{ if(hit.gameObject.tag == "fallout") { dead = true; } }

function Update () { var controller : CharacterController = GetComponent(CharacterController);

``````transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);

var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);

``````

}

function LateUpdate()

{

``````if(dead)

{

transform.position = Vector3(37.88445,317,-91959.91);
gameObject.Find("Main Camera").transform.position = Vector3(0.1091721,400.804633,-0.8778622);
}

``````

}

@script RequireComponent(CharacterController)

thamks 4 your time :D hope you can help

Not sure what you mean by 'stays at 90-degree angle', but typically the way this is handled is to apply a corrective rotation to the object that aligns it (either immediately, or over some time interval) with the normal of the surface beneath it. (In Unity, the function FromToRotation() can be used for this.)

If that doesn't give you enough info, perhaps you could edit your post and tell us more about the problem (e.g. whether your object is represented with a character controller, rigid body, etc.).

the same things happened with me but there are various ways you could get this problem but i didn't have gravity implemented on my car... just trying to help and have a merry christmas