i have just start to develop a car game the problem is during execution is that . . . when i turn my car its roll over and i don’t want that . . . . plz tell me how to fix this problem ? ? ? ? ?
here is sample code . . .
#pragma strict
function Start () {
}
var wheelfrntlft : WheelCollider ;
var wheelfrntrght : WheelCollider ;
var wheellft : WheelCollider ;
var wheelrght : WheelCollider ;
var speed = 10 ;
var breaking = 25 ;
var turning = 10 ;
function Update () {
wheelrght.motorTorque = Input.GetAxis(“Vertical”) * speed ;
wheellft.motorTorque = Input.GetAxis(“Vertical”) * speed ;
wheellft.brakeTorque = 0 ;
wheelrght.brakeTorque = 0 ;
wheelfrntlft.steerAngle = Input.GetAxis(“Horizontal”) * turning ;
wheelfrntrght.steerAngle = Input.GetAxis(“Horizontal”) * turning ;
if(Input.GetKey(KeyCode.Space))
{
wheellft.brakeTorque = breaking ;
wheelrght.brakeTorque = breaking ;
}
}