- Home /
How to get a rigidbody's Local Angular Velocity (Yaw, Pitch & Roll) ?
I had some trouble finding how to get a rigidbody's local angular velocity (with respect to its own Axes instead of the World's), which can be useful for Flight / Space simulator games, so i thought I would post the way I overcame that problem.
Hope it saves you some trouble :)
Answer by Anisoropos · Mar 04, 2013 at 07:46 PM
The solution to this problem came by slightly modifying an answer I came across, posted by user RavenBlack:
Vector3 localAngularVelocity = target.transform.InverseTransformDirection(target.rigidbody.angularVelocity);
localAngularVelocity.x is the target's Pitch,
localAngularVelocity.y is the target's Yaw,
localAngularVelocity.z is the target's Roll,
assuming the target's forward is aligned with its z axis.
Glad i could help! If you found my post helpful don't forget to vote it up :)
Thanks for this, my test course was 90% aligned with the world z axis forward so I was only noticing occasional unusual behaviour just using the rigidbody.angularvelocity, finally today I worked out what was going on and then found this code and now everything behaves as expected
Your answer
![](https://koobas.hobune.stream/wayback/20220613093400im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Setting the roll of a rotation 1 Answer
Yaw, Pitch, Roll adjustments relative to object? 1 Answer
pitch yaw roll user input on an object? 2 Answers