WheelCollider - Problem with model rotation

First of all I have to mention that I have just started to get familiar with Unity engine, so my question is probably really basic. :slight_smile:

As my first task I would like to create simple car with simple controlling so I followed this tutorial on Unity’s site: WheelCollider Tutorial

I could achieve to control my car but I stucked at adding a visual model to wheel collider.
Here is my object hierarchy and how I set the models:

And this is the scene and game windows:


As you can see on the scene screen the wheels’ rotation is fine but when I start the game it goes wrong. The wheels are turning and rotating but on a wrong way furthermore the car is not moving when I rotating the visual models. If I turn off the visual rotation the car is moving.

My assumption is I cannot rotate the wheels’ model on scene because it will be rotated back according to the script: (I’m using the same code which is in the tutorial)

collider.GetWorldPose(out position, out rotation);
visualWheel.transform.position = position;
visualWheel.transform.rotation = rotation;

So my questions:

  • How should I set the visual wheel models to display them correctly on scene and in game as well? And keep the car moving.
  • The tutorial gets first child transform and after that it gets again transform of visualWheel. Why it is necessary? Shouldn’t we use only visualWheel?

Hi, I encountered the same problem as you.

  • For the first question I already posted a solution in the forums, here.
  • What you are doing in the tutorial script is saving a reference to the position an rotation of the visual wheel object first, and later, after the changes in the WheelCollider happen (that’s why it’s exec from the FixedUpdate), you update your visual wheel object with the collider’s position and rotation.

Hope this helps.