# Tire mesh rotates faster than wheelcollider in Unity

I have a car in Unity. Scripts are C#. I have noticed that my tire meshes' rotation is faster than whellcollider rotation. I am using this code for wheel rotation

 flWheel.localEulerAngles = new Vector3(flWheel.localEulerAngles.x, flWheelCollider.steerAngle - flWheel.localEulerAngles.z, flWheel.localEulerAngles.z);
frWheel.localEulerAngles = new Vector3(frWheel.localEulerAngles.x, frWheelCollider.steerAngle - frWheel.localEulerAngles.z, frWheel.localEulerAngles.z);

flWheel.Rotate(flWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
frWheel.Rotate(frWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
rlWheel.Rotate(rlWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
rrWheel.Rotate(rrWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);


I found this from here

Does anyone know how to fix this?

Edit:

Using AquaGeneral's answer I could able to solve rotation problem. But now front right tire position changed to rear left tire position and rear right tire rotated 180 on Y axis. need help

The code you found is not the ideal way to go about this. Instead of figuring out exactly what is causing the issue for you, just use the builtin function: WheelCollider.GetWorldPose.

From the official Unity Wheel Collider Tutorial in the ApplyLocalPositionToVisuals function/method:

// Get the child of the wheel that has the mesh renderer
Transform visualWheel = collider.transform.GetChild(0);

Vector3 position;
Quaternion rotation;
collider.GetWorldPose(out position, out rotation);

visualWheel.transform.position = position;
visualWheel.transform.rotation = rotation;

• Rotation problem solved. But tire meshes positions changed. How fix it? Commented Jul 2, 2016 at 7:51
• @SajithaRathnayake Could you explain further about what you mean by "tire meshes positions changed"? Commented Jul 2, 2016 at 12:02