This sounds like a very standard case of float rounding error, see here:
How big of an error are we talking about here? There is a SnapToGrid (float) node that helps with this.Error also confirmed with UE Version 4.18 (Make rotator / make transform - problem with incorrect values - Blueprint - Epic Developer Community Forums)
Here is the used blueprint and the Error. The node you see is the one and only active node. The “Transformer” is an editable transformation variable.
It´s impossible to rotate correctly around the z-axis… (i need this pretty much for a building script) .
Thank you.
Well, the Problem gets problematic when you rotate more than one time. I am building a complex house and use the transformation to store the position data of the meshes, that means i am rotating a couple of times, coming from the last position i stored in the array…
So i first type in 90 dregrees: i get 89.999999985… than i rotate from 89.999999985 again 90 degrees and get 179,98777 and so on… as you can see, sooner or later my positions are off. When i build a square house consisting of 16 meshes, the last mesh is 20-25 Unreal units off (x and y), which is not so good in my case.
I will look into the snap node… thank you
The problem seems to be within the transformation node itself… the snap to grid function doesnt really help me, because i have to make “make transformation”-node to put it into the add static mesh component.
SnapToGrid after every operation and then push the result into a new transform. Create a small macro to automated this.
With this applied, can you confirm the following:
the last mesh is 20-25 Unreal units
off
Doesnt work… As you can see in the blueprint, i fixed the value of the “make transform” to 90 degrees in z-axes, but ue4 tells me 89.9999995 in the editor.
It doesnt matter what values you put into the make transform node, they can be super precise, but the node itself seems to handle the operation of calculating angles wrong (floating round error you mentioned?) . This does not really make sense to me either, because i am telling the exakt angle, there should be nothing to calculate…
Here comes the vid…
When the angle is not perfectly 90.0 degrees, the resulting vector gets also off… xcos phi + ysin phi is the formula for calculating the resulting vector.
As you can see very small incorrect values can cause a real problem…
Thats why i need absolutely correct values here…
Yeah, that’s pretty bad. This is too big for a float rounding error. Although I can see how this can very easily pile up.
Is there an option to see what the make transform node actually does ? Maybe it is possible to change the function itself… i am not a c++ geek but when it needs to be done i might have no choice…
Found a solution:
This is the blueprint that moves the transformation widget to the next position. The position gets obviously off when the angle is wrong (summarized problem) . Now i snap the position of the resulting vector to the grid, in this way the new position is not xxxx.9999983 or whatever but 400.0 . Basically a workaround but should work for me… Thanks for all your efforts !!