unity, javascript
hey guys, please help, this is a script for a racing game im making to control the car… my car is supposed to go forward, backwards, and turn both left and right well and it was working well but i must have messed something up because it wont turn left or right almost at all anymore. heres the code. any help is greatly appreciated ![]()
#pragma strict
var wheelFL : WheelCollider;
var wheelFR : WheelCollider;
var wheelRL : WheelCollider;
var wheelRR : WheelCollider;
var wheelFLTrans : Transform;
var wheelFRTrans : Transform;
var wheelRLTrans : Transform;
var wheelRRTrans : Transform;
var maxTorque : float = 50;
function Start () {
rigidbody.centerOfMass.y = -0.10;
}
function FixedUpdate () {
wheelRR.motorTorque = maxTorque * Input.GetAxis("Vertical");
wheelRL.motorTorque = maxTorque * Input.GetAxis("Vertical");
wheelFL.motorTorque = maxTorque * Input.GetAxis("Horizontal");
wheelFR.motorTorque = maxTorque * Input.GetAxis("Horizontal");
}
function Update () {
wheelFLTrans.Rotate(wheelFL.rpm/60*360*Time.deltaTime,0,0);
wheelFRTrans.Rotate(wheelFL.rpm/60*360*Time.deltaTime,0,0);
wheelRLTrans.Rotate(wheelFL.rpm/60*360*Time.deltaTime,0,0);
wheelRRTrans.Rotate(wheelFL.rpm/60*360*Time.deltaTime,0,0);
}