How do I detect rotation in a RigidBody physics object?

Hi, I’ve been struggling to do something that is obviously not that difficult because I don’t see a thread with anyone else having the same problem!
Basically, I have a vehicle and I want to detect if it spins, and if so, how many times.
I’ve coded it once, and it detected spins that weren’t there.
Now I’ve done it again and it doesn’t detect any.
This is my code:

private void TrackRotations() {
float facing = Chassis.localEulerAngles.z;
float angle = facing - _lastRotationPoint;
_totalRotations += angle;
_lastRotationPoint = facing;
var rotCnt = TotalNumberOfRotations;
if (_highestRotation == rotCnt) {
return;
}

Any help would be greatly appreciated because this is driving me nuts now!

Can you just check the rigidbodys angular velocity? If it isn’t zero, it should be rotating.


            rb.angularVelocity.magnitude

Thanks Vega4Life, but I also need to know how many times it’s rotated, which is more difficult!

@Vega4Life - Thanks- I only need to count complete rotations, in either direction.
I thought I was, but I’m getting none registered with my code so it’s obviously wrong…