Cancel out the steering rotation returned from a wheel colliders .GetWorldPose(out pos, out rot);

I’m trying to get the spin rotation of a wheel from the wheelCollider, but wheelCol.GetWorldPos(out pos, out rot) returns the rotation as a world space quaternion which includes the steering information. How can I get the spin rotation minus the steering?

Quaternion worldSteeringRot = mWheelCol.transform.rotation * Quaternion.AngleAxis(euler.y, Vector3.up);

I thought I could do something like multiply “rot” by worldSteeringRot or the inverse of it, but so far I haven’t had much luck in my tests.

Found a solution. Take the inverse of the wheel colliders transform rotation and multiply it by the full calculated rotation. That does the world->local translation. Then using a quaternion containing the previous frames opposite steering (-Y) rotation, multiply that by the local rotation. Now you have the proper spin of the tire without the steering included in local space.

Vector3 pos;
Quaternion rot;
mWheelCol.GetWorldPose(out pos, out rot);
Quaternion localRot = Quaternion.Inverse(mWheelCol.transform.rotation) * rot;
localRot = Quaternion.AngleAxis(-mLastYRot, transform.up) * localRot;
wheelNode.transform.localRotation = localRot;