Visual wheels rotating around wrong axes (WheelCollider Tutorial).

Following WheelCollider Tutorial tutorial I’ve got wheels flipping like coins.
How it looks in the editor:

This is how it looks in a game:

(why position values always changing while car is not moving ?)

Position of front left empty object (front left wheel):

Position of cylinder for front left wheel:

I tried to change rotation field for visual wheels but game mode always sets Z Rotation to 0.
During drive, rotation of visual wheel happening around X axis.



3081340--231962--frontLeftEmpty.png
3081340--231965--frontLeftVisual.png

1 Like

I created cylinder in Blender so that X axis comes though wheel’s axis (through flat side). But now there is another problem - wobbling wheels.

I got the same problem.

What I did was to put the visual wheels object (which were just built-in unity’s cylinders) on a empty parent, and rotate my wheel meshes inside the wrapper parent, but leave the parent with the transform reset.

Then I removed the colliders in the cylinders object, because of this the car didn’t move. After all we already have a WheelsColliders in the grandparent of the visual wheel gameobject.

To stop the wobbling effect in the wheels I first fixed X-Axis rotation on the rigidbody of the car root element.

Then I found this, where a user recommends to change the damper of the WheelCollider to the same as the mass for a 4 wheel car.
This also seems to fix the wobbling effect.

I think that tutorial needs some editing, but well, this is as far I could get. If anyone has more idea on car controlling and can shed some light here, I’d be really grateful.

3 Likes

For me what I did, was take the rot return of the wheel collider and add 90 degrees to the y axis like this:

void UpdateWheelPos(WheelCollider col, Transform t)
    {
        Vector3 pos = t.position;
        Quaternion rot = t.rotation;
        col.GetWorldPose(out pos, out rot);
        rot = rot * Quaternion.Euler(new Vector3(0, 90, 0));
        print(rot);
        t.position = pos;
        t.rotation = rot;
    }

Before and after

6 Likes

my problem is that the steering wheel flips like a coin

multiply the rot, like this = rot * Quaternion.Euler(0, 0, 90).
it fixed mine

my problem is the left front and rear wheel are flipped how do u fix that?