Get the Rotation from any Object results in a wrong pitch value

Hiho,

i have little big issue with the pitch value when i wanna get the rotation of any object, actor, pawn…whatever.

It is really wierd.

Let’s make a very simple example:

93602-file1.jpg

Make vector node is our forward vector. Image an object and it would be upside down half.

Let’s get the rotation! I would assume a value like “Pitch=135”. Yaw and Roll are zero. Easy math!

What i get is Pitch=45. Pitch values are between -90 and 90. Always! Whatever rotation i use, whatever object i rotate, whatever workaround i try. I have read all the pitch bug posts and solutions. I know the gimbal lock thing.
But even if the axis values are not zero, the pitch value is wrong.

I prefer BP. I would use C++, but the problem is much bigger than i thought. Because it is not the calculation, it is the “get value” at any state. If an object is upside down, i want the right pitch. I cannot rewrite the whole rotation stuff :smiley:

Thanks in advance. If anyone has a slight and right solution, i would appreciate :smiley:
How would a new “Get World Rotation” function look like. I could work with that a new get rot function.

Cheers

raidfire.net

Also have the issue (4.20). Did you figured any workaround?

The pitch isn’t “incorrect” per se it just isn’t using 0-360 scales. It as the OP state always stays between -90 and 90. You can test this yourself by having a print string on tick while you rotate an object through 360 degrees of pitch. When it hits 90 or -90 degrees of pitch the roll and yaw instantly flip from 0,0 to -180,-180 which results in an identical “world rotation” but obviously the “values” reported from a “Get” node would be those of the equivalent rotation NOT the pure rotation through >90 of pitch. So the engine will never report a pitch of >90 from a “Get Rotation” node because it isn’t set up to do so. If you want to fix that you would have to come up with your own C++ function to return the rotation on a 0-360 scale. I have tried writing a C++ function to do just that but it wasn’t perfect, it was difficult to determine when 180 needed to be added or subtracted to the engine output for pitch to place it on a 360 degree scale. But that is what you need to do if you want this result.

Nebula is absolutely right… but just also to mention that Get Control Rotation DOES use 0 to 360 degrees value