Hello, I was following [WheelCollider Tutorial][1] in Unity documentation and I'm kinda stuck at making the visual wheel rotate correctly. Here's my code:
public void ApplyLocalPositionToVisuals(WheelCollider collider)
{
if (collider.transform.childCount == 0)
return;
Transform visualWheel = collider.transform.GetChild(0);
Vector3 position;
Quaternion rotation;
collider.GetWorldPose(out position, out rotation);
visualWheel.transform.position = position;
visualWheel.transform.rotation = rotation;
}
In the editor view my wheel looks like this:
![alt text][2]
however, when I enter the game view and rotation gets applied it looks like this:
![alt text][3]
Here's what my visualWheel setup:
![alt text][4]
[1]: https://docs.unity3d.com/Manual/WheelColliderTutorial.html
[2]: http://i.imgur.com/pWihb32.png
[3]: http://i.imgur.com/oJSTEmB.png
[4]: http://i.imgur.com/RuqT6R0.png
↧