Hello, i’m making a car project, i made 4 wheel colliders and made the 2 rear wheels move the war with motor torque, the problem is , i’m only using forward/backward movements, the car moves a bit to left / right when i change between forward and backward,
this is the car script, and below it the web player link if you want to give the game a try yourself
#pragma strict
var BackLeft : WheelCollider;
var BackRight : WheelCollider;
var VBR : Transform;
var VBL : Transform;
var VFR : Transform;
var VFL : Transform;
function Start () {
}
function Accelerate () {
BackLeft.motorTorque = Input.GetAxis("Vertical") * 100;
BackRight.motorTorque = Input.GetAxis("Vertical") * 100;
}
function Visual () {
VBR.Rotate(Input.GetAxis("Vertical") * 100 * Time.deltaTime, 0, 0);
VBL.Rotate(Input.GetAxis("Vertical") * 100 * Time.deltaTime, 0, 0);
VFR.Rotate(Input.GetAxis("Vertical") * 100 * Time.deltaTime, 0, 0);
VFL.Rotate(Input.GetAxis("Vertical") * 100 * Time.deltaTime, 0, 0);
}
function FixedUpdate () {
Accelerate();
Visual();
}
one wheel might be starting before the other
– Fornoreason1000