WheelCollider.GetWorldPose returns NaN rotation

Hello Everyone,

I’ve set up a car with 4 Wheel Colliders and everything is functioning properly, except for the fact that the rear wheels of the vehicle don’t rotate, but they do change their position (respond to the suspension). I eventually tracked this down to the WheelCollider.GetWorldPose function, and after logging the rotation, I found that it returns a NaN quaternion (rear-left and rear-right Wheels). I have seen from another thread that PhysX can spit out NaNs with really high forces, but I’m not creating these types of forces here.

9819450--1411290--log.PNG

Another issue I’ve found is that during game mode, the rear Wheel Collider’s main gizmos disappear, except for the two smaller gizmos:
(Meshes simplified for troubleshooting)

While in edit mode, everything looks normal:

Finally, here is the code in question:

void UpdateWheel(WheelCollider collider, MeshRenderer mesh)
{
Vector3 position = Vector3.zero;
Quaternion rotation = Quaternion.identity;

collider.GetWorldPose(out position, out rotation);
//Debug.Log(collider.name + ": " + rotation);

mesh.transform.position = position;
mesh.transform.rotation = rotation;
}

I think this might be an issue with the wheel collider itself and I’m aware that the Wheel Collider isn’t very polished, so this is probably a signal for me to create a custom Wheel Collider or use an asset. Any help would be greatly appreciated.

Update: After some tedious troubleshooting (commenting out parts of the code one by one), I found out that the cause of the problem was the differential code which, in the first frame of the game when all the inputs were 0, output the signed 32-bit integer limit (-2147483648). This Torque value was then fed into the 2 wheel colliders (the car was RWD) and caused this issue. So, the problem actually was that PhysX got too small of a value. The line that did the damage was multiplying 0 by 0.5f, which caused a NaN, and then 0 - NaN, which output the integer limit. To prevent this I just checked if the variable that caused the issue was zero before dividing. Just a quick reminder that computers are both somehow terrible and great at math at the same time. Hope this is helpful to anyone with the same issue.