- Home /
Car goes a bit left when moving
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();
}
Answer by pudd1nG · May 01, 2013 at 03:55 PM
This is a pretty well known 'bug' or effect with the sideways slip value of the wheel collider. You can get rid of the issue by setting the sideways slip to a high value, however you then get a very 'sticky' wheel.
I'm going to guess you're driving on a completely flat plane - when I've created a wheel collider object on rough terrain I've never had the issue.
Your answer
Follow this Question
Related Questions
Getting contact force between two rigidbodies 1 Answer
Vehicle engine RPM without wheelcolliders? 1 Answer
How to make a car not slow down while turning? 2 Answers
Raycast align with ground normal 2 Answers
CarController Script Error 1 Answer