- Home /
Finding roll angle
I've been scratching my head for days now, if someone could help with this, I'd appreciate it.
Basically, I have an object with a well defined "forward" (blue), "up" (green) and "right" (red) vectors. Now say I rotate this object in the world arbitrarily. I need to find out how much it rolled around its forward vector (angle in degrees, with zero being not having rolled at all: ie, "up" is still "up")
The following image might help a bit:
Please keep in mind that rotations might stack with a parent, so localRotation doesn't work, unless the parent is still.
Also, in the special case that "forward" is aligned with "up", the new "up" should be the world's "back".
You could store the original position rotate then store the new rotation angle and compare the two. if i understood your problem correctly.
https://docs.unity3d.com/ScriptReference/Transform-eulerAngles.html
Compare what with what? :3
Euler angles would only work "forward" (the blue vector) was aligned with x y or z. But, it might be pointing anywhere.
It's more like angle-axis, although I need to know the angle for a given axis, regardless of the quaternion. If the axis is perpendicular to the rotation, then the angle would be zero, if that makes any sense to you :3
Your answer
Follow this Question
Related Questions
Change the roll of the rotation 0 Answers
Why is this rotation acting odd? 0 Answers
Connecting transform with Vector3 4 Answers
Quaternions acting up 1 Answer
How to get Angle float of specific axis.(Turret clamping related). 2 Answers