Hey guys ! So Trying to grab rotational Y Axis data from an actor and pass that threw to control a parameter in a material instance. however there seems to be a huge issue very apparent even inside the game viewport,
For example to help visualise… lets grab and rotate the Y axis on the positive rotation within the editor viewport,
I get some funky results first starting at hitting around every 90 degrees.
Here’s a break down of what i see happening as i spin a mesh 360 degrees:
At 0 to 90 degrees: that works ok ( X: 0) (Y:0 to 90 as we spin) (Z= 0)
At: 90 to 180 degrees: (X= -180) (Y getting: 90 to and back to 0 as we spin) (Z= -180)
At 180 to 270 degrees: (X= -180,) (Y is getting 0 to -90 as we spin) (Z= -180)
At 270 to 360 degrees: (X= 0) (Y is getting -90 to 0 as we spin) (Z = 0)
The thing is that i need to have a consecutive numbers feed back from Y axis 0 up to 360.
I can’t use X or Z because they are feeding other paramiters (For exampole i can spin 0 to 360 on each X and Z and they are not jumping around),
So my question: Is there a way to cheat around the Y axis issue or some kind of solution i can use to translate above outlined issue into consecutive degrees digits for Y axis ?
Wow, No one even replied?! Had the whole team trying to figure out whats going on for the past days now. It’s holding the project back because our animation system seriously depends on consecutive data feed back from X Y and Z rotations. To me it feels like someone in Epic had forgot to finish up the Y Axis data feedback or something. really need this fixed or some kind of workaround. Please help us !
I’d like to try to provide some more details on the numbers which are being displayed in the editor, in comparison to the numbers you are seeing in the detail panels of the editor.
Sometimes the numbers we see in viewport will not match the transform values(X,Y, Z) of the actual actor. I believe this is to allow the slider functionality in the editor to work.
Your Y is rotation is actually clamped between the numbers of 90 to -90.
Allow me to show you a quick way to troubleshoot some of these numbers.
Here I’ve created a blueprint actor, and have attached a static mesh actor of a cube.
In the construction script of this actor, I’ve taken a reference of the static mesh and used a GetWorldRotation function, I then right click on the return value and choose to split the structure pin. This allows me to get individual data values of X,Y, and Z. We can then print these values to the screen to get a more accurate representation of our coordinates.
This should give you a more accurate representation of your mesh, and it’s transform values. Please let me know if those numbers are still clamped between 90 and -90, and if they are resetting in the printed string, vs resetting in the editor viewport.
Hello thanks for the quick reply !
Its printing out to screen clamped yet, I’m only rotating on Y axis btw. getting the same behavior as my initial description. Passing the 90 point on Y makes about -180 degrees on X and Z
Yes they are resetting in the string ( if you mean updating ) I supplied a screenshot, check out the rotator gizmo, its displaying the correct Y rotation there at least. ( should be -120 for the print put to screen)
Yeah we already understand this much XD. Anyways how do we get around it? That is the main concern. is there a way that we could convert it back?
-180 subtract -60 = -120 of course. but still adding in your regular X and Y values would contaminate…
I believe the issue is how the engine handles going over 90 degrees of pitch. Because somewhere in the source code it is clamped to values of (-90 to 90) it will never allow a rotation of +120 pitch. What it does is convert the extra 30 degrees into an equivalent rotation where the yaw and roll are flipped 180 degrees. So a rotation of 0,120,0 (roll, pitch, yaw) is the same as a rotation of -180, 60, -180. Unreal prefers to have roll and yaw at 0 degrees while pitch goes from 0 to 90, but once the pitch becomes 91 degrees, it flips roll and yaw to -180, and starts subtracting the added “pitch” from 90 so it will output -180, 89, -180 for a rotation where the pitch is 91 and roll and yaw are 0.
I tried messing around with that very thing in C++ to create a blueprint node that would only return values of 0 to 360 for all axis. I was able to do it for X and Z because they didn’t flip the other axis when they went past 180, just became negative so it was easy to add back the 180 degrees of lost rotation and keep everything positive going to 360. But for the pitch I was unable to come up with code that would consistently return a positive value for pitch. I couldn’t come up with a set of rules that would work, always seemed to be a quadrant of the graph that would be messed up. If you figure out the code I would be interested to know, but I gave up trying and haven’t worked on it since.
Ok I got this far! I can rotate Y 0 to 359 degrees (0 counts as 360) and print them to screen.
But with this method, its not usable for me, because as soon as you start changing Z rotations, Y values go to hell.
I can not for the life of me figure out how to filter out standard Z Axis from effecting the Y Axis…
I’m ready to pay someone to get a method that prints X Y and Z to screen each axis in 360 degrees…
(or rather 0 to 359 when rotating an object) ( It could also be 0 to infinity)