Rotation values are messed up.

Hello everyone,

Because i have reported this 2 times in the aswerhub already and it gives me headaches for almost 6 months now, i decided to post it here as well hoping that it will get more exposure and a appropriate developer will see it and will finally do something about it .

Look for example No 5 and 6. They are both 0,0,0, but for some reason unreal decides to give one of them pitch and roll values. No 8 is 90,0,0 but here you can clearly see that the values assigned from the system are 90,0,180 .

This creates huge problems when you try to combine rotators because every time it will give you a different value and this results in undesired behavior like flipping my sprites or rotating them in the opposite way .

Thank you.

Can you describe a bit better what you are doing and how you set the values?
It is very hard to get a good idea from what you write.

How do you set the values? And how does UE4 give you feedback about the values (getWorldRotation or similar?)

i wasn’t very detailed because this was aimed toward a developer and not for the community.

Sorry about that. I will try to explain as best as i can.Your wish my command :stuck_out_tongue:

For some strange reason since i first started using Unreal back in the summer i noticed that whenever i rotated anything (paper2d project) in the editor (for example a blueprint actor) for lets say 90 degrees (mind you that since i am on a 2d plane i have no need for Yaw and Roll so they are always 0) and then tried to get that world rotation value from somewhere else it gave me the above random numbers. It appears that it is the exact same rotation (90.0.0 = 90.0.180) visually but not mathematically when you want to combine rotations . This leads to all sort of weird behaviors when you want for example to Lerp something.

I was asking because I encountered similar behaviour last week.
Was setting solely pitch and yaw, without roll, and after using getWorldRotation, UE4 returns some roll and less pitch and yaw.

It might be related to the Euler angles used in UE4 Rotators and that you can have different angle sets for Pitch,Yaw,Roll in 3D to reach the same end rotation. (google aliasing+euler angles).
If any dev reads this, it would be useful to know how UE4 selects a set. But looking at the ‘documentation’, chances are low.

In 2D, when you only have one angle, and UE4 gives you some other angle after using getWorldRotation, then that’s a bug.

In 3D however, with 3 angles involved, it might be Euler Angle Aliasing. -> two angle sets, same end rotation

Would be interesting to see for one example what UE4 gives you instead of what you expect
I could not make sense of what #5, #6 and so on in your array are supposed to be. Neither will a developer with the sparse infos. They are no detectives :wink:

Lol!
Unreal CSI!

I am fully aware of gimbal lock (someone told me to be exact a few months ago) but i am not trying to rotate in all three axis. Only in one so i see no reason why it goes bananas on me.

My array is set like this. Event begin play get all actors of class---- for each loop---- get/save world rotation to a array. What you see in the picture is the result of all actors currently in my level and the rotation values of each. All of them have either 0,0,0 or 90,0,0 in the editor. If you want more info on this since you seem very knowledgeable and you might be able to help read this:Pitch,roll,yaw and Paper2d Question - Programming & Scripting - Epic Developer Community Forums and this : Master branch release (19/1/15) has broken (again!) my rotations - Cinematics & Media - Epic Developer Community Forums

Everytime i update the engine the rotations stop working as intended. I do not know what to do anymore. I hope they will see this and fix it once and for all because 7 months with the same issue is a LONG time!

1 Like

I am definitely interested in solving this, also because I had similar problems.

Regarding the flips in rotation, I tested this:

  1. take a narrow capsule shape, then rotate it before simulating and then hit play/simulate and read the rotation with getWorldRotation from another Blueprint.
    ->> when pitch reaches 90°, then yaw flips to 180° or something. It will check it again, since I very recently hit that barrier myself and it still needs solving.
    There is definitely a flip in one or two axis…I remember this.

Too bad stuff like this is not documented…for example is UE4 rotation left handed or right handed…No one knows.

Did a quick test and opened an empty scene, deleted the two chairs, table and stuff and loaded a narrow capsule. Then converted the capsule to BP and put getWorldLocation and printString in the BP.

Here the result:
I only put 170° around Y-Axis and the getWorldRotation gives me some mixed angles. It’s Euler aliasing. (170° around Y gives same end rotation as 10°, then 180°, then 180° as shown in the screenshot)
There is also a flip from 180 to -180 if you only rotate around x-Axis. But that’s ok.
The Euler Aliasing is much worse! In this example it is very obvious how to get to the straight 170°, but usually it is a back breaker.

Would be also nice for consistency to have roll, pitch and yaw in the rotation, and not x,y,z.

Could someone please walk over to the devs in your Office, Epic, tell them all they are fired, unless within one week, the have provided your technical writers with a proper documentation of what they are hacking in their dark corner day and night :slight_smile: