Using the studio default tools, if you grab an object, and rotate it(R key), it’s rotation is sometimes by 89.98/89.875/etc, I noticed that while I was building, all my parts were creeping out of alignment little by little, and just realized why, after the creep started again, I noticed it after posting this thread: someone please make this into a plugin
Shouldn’t Roblox be using matrices to avoid this floating point imprecision problem?
This is exactly what causes the imprecision. They’re not just adding numbers to the values in Rotation, they get calculated from the CFrame of the object.
? matrices at a normal rotation have something like [1,0,0][0,1,0][0,0,1], and their rotation math is easily computed to be exact, so, a 90* rotation on the Y axis will produce [0,0,-1][0,1,0][1,0,0], floating point imprecision shouldn’t affect something as simple at that, my own game engine has no issues at all with 90* rotations, and roblox used to have no issues as well… it just kinda seems like this started happening
Does this happen with default parts, or is there a specific object this occurs with? What OS are you using? Have you tried it without using any plugins?
> c = CFrame.new(0, 0, 0, 0, 0, -1, 1, 0, 0, 0, -1 ,0)
> x, y, z = c:toEulerAnglesXYZ()
> print(math.deg(x), math.deg(y), math.deg(z))
-90.000002504478 -90.000002504478 0
The floating point imprecision is due to obtaining the angles from the CFrame. The Properties window uses a similar method to update the Rotation property every time the CFrame property changes of the object. So while the angle may seem incorrect in Rotation, it might actually be just fine.
Windows 8.1, normal parts, happens whenever I rotate any part in this one place of mine, I don’t use anything but the default rotate tool, you can have a simple repro place/screenshots if it helps any
It seems to happen on more than 8/8.1 for me so it looks like a more systematic issue, although I still haven’t had it occur with only using R to rotate the object. The steps are fairly simple so no repro place is needed. Thanks for the help!
This is still happening (to me anyway).
I have noticed that Wedges seem to have the issue more than Parts.
I have a Wedge in my place that I’m trying to Union with other Parts. I’ve noticed that negative angles, or angles that have decimals don’t Union well, so I tried setting the Rotation of the Wedge to 0,0,0 and using the Studio Rotate tool to place it the correct way.
After using the 1 stud grid (45 degree angle movements) to rotate the Wedge by 90 degrees in 2 planes, I get a Wedge that appears to be aligned with the other Parts correctly, but when I check the Rotation I find it’s at -128.927, 89.98, -141.073.
By that Position the Wedge shouldn’t be aligned to any x,y,z plane at all!
Also, changing any value in the Rotation manually (say, the 89.98 y axis to 0) completely changes the other angles.
This makes Unioning parts very much a pain in the ass.
Instead of multiplying the cframe by a 90 degree matrix, it should flip the components of the two perpendicular vectors, and make one negative. I recently updated my geometry plugin to do 90 degree rotations without matrix creep (the “Part Flip” tool):
Edit: CFrame.Angles(math.pi/2, 0, 0) wont create a perfect 90 degree matrix because radians aren’t exact (you can get values like 0.0000000437 instead of 0). Multiplying by a perfectly aligned matrix composed of 0’s, 1’s, and -1’s should be okay.
Rotating the part in the repro file (starting at <0,-90,0>) gives rotation values of <-179.998, -44.998, -179.997> and <-0.002, -45.002, -0.003> when rotated left/right using the default rotate tool and the 1-stud increment.
OS: Windows 10. Pretty sure this happened when I was using Windows 7 as well.