I’ve imported the wheel asset from Blender. Right now, I have the wheel in a separate Blender file saved at a 0, 0, 0 rotation (and then correctly positioned in Unity), and the wheels immediately offset 90 degrees upon moving into Game/Play mode. At first, I had the wheel model oriented correctly in Blender within the complete ATV package, and I got the same malfunction. Below is a link to a video of my issue.
UPDATE: I managed to fix the issue myself, so I thought I should post what I did.
public void Update()
{
//Sets the wheel meshs to match the rotation of the physics WheelCollider.
UpdateMeshPosition();
}
//Sets each wheel to move with the physics WheelColliders.
public void UpdateMeshPosition()
{
for (int i = 0; i < 4; i++)
{
Quaternion quat;
Vector3 pos;
//Gets the current position of the physics WheelColliders.
wheelCollider[i].GetWorldPose(out pos, out quat);
///Sets the mesh to match the position and rotation of the physics WheelColliders.
wheelMesh[i].position = pos;
if (i == 1 || i == 3) {
wheelMesh [i].rotation = quat * Quaternion.Euler (0, 90, 0);
} else {
wheelMesh [i].rotation = quat * Quaternion.Euler (0, -90, 0);
}
}
}
So I translated the ‘quat’ variable (obtained through the ‘GetWorldPose’ property for Wheel Colliders) by 90 degrees on the Y axis, and the sign (pos/neg) varies according to which side of the ATV the wheel is on. To clarify, multiplying the Quaternion angle by the Euler angle you want to modify actually acts how you would expect addition to function.