- Home /
how to fix car rolling problem
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 ; }
}
Answer by vcjr12 · Jul 02, 2013 at 08:41 PM
Well, i cant answer your question directly but you could try giving Edy's Vehicle Physics system a try. It can show you how to prevent those kind of problems in your cars.
Your answer
Follow this Question
Related Questions
Speed indicator (Problem) 0 Answers
How to configure a rope like joint 0 Answers
Shift gear with own RPM? Help please! 0 Answers
How do I set the maximum wheel rotation on my car? 1 Answer
jcar script help here ... 0 Answers