Transporting a Transform between functions results in an incorrect rotation

I’ve created a widget with 3 spinboxes for the rotation of a transform and when the value of any spinbox changes it calls an event dispatcher with the created transform as a parameter.

The level blueprint has an event assigned to the dispatcher of the widget and sets when called the transform to a cube and then, with a function inside the widget, the SAME transform created from the spinboxes back to the spinboxes.

The expected result was that the spinboxes will stay on the same values

because they should have the same values back from the transform which got transported from the spinboxes itself to the level blueprint and then back to the spinboxes.

I made a short video to show what I mean and also added the project here.

At the beginning of the video is the wrong result and at the end the expected.

Hello Doktor,

It looks like you are running into Gimbal Lock, which is what is causing the issues. Take a look at this post and see if the information here helps:

Thanks,
Tyler

Thanks for your answer, but how do I get into the Gimbal Lock when I’m just passing the transform between functions?

Hello Doktor,

The issue is that, due to limitations of the engine, the Pitch axis hits Gimbal lock around 90 degrees. This is typically avoided by the other 2 axes being adjusted to compensate nearly instantaneously, but you are passing values back to the widget to transform those axes at the same time, which is causing them to be unable to compensate for Gimbal lock.

Thanks, Tyler