C# - local angularVelocity

Hello, i’ve been asking this question few times already. I wonder if it’s that hard or no one answers for some other reason.

I need to detect objects rotation in local axis. Not to make it rotate in local axis but to detect its rotation in local axis.

My code:

if (Spaceship.rigidbody.angularVelocity.z > 0)

It does what i need but only in respect to worlds axis.

Thanks for the help.

This should work:

var localAngularVelocity = transform.InverseTransformDirection(Spaceship.rigidbody.angularVelocity);

Note that Rigidbody.angularVelocity is in radians. Shouldn’t matter if all you are doing is testing against 0.0.