I have created a model which is cloned and then positioned in place. My problem is when the object is rotated the X-axis doesn’t change but suspected x-axis is added to the Z-axis, So in
Maybe this is because of Gimbal Locking. Try separating the rotations or performing them in a different order.
If pasting that same orientation into an object changes it, then that also means this is happening.
Here is a visual of your rotation, however: https://i.gyazo.com/40b08b81d7eef30c539a33a7dc194676.mp4
This is from a static <0, 0, 0> orientation.
Notice how the object now has no rotation about the X axis!!!
I did some testing and when i just rotate x axis, this works, but adding the y axis causes this “Gimbal Locking”. What would be the best way to individually rotate along each axis then?
It is mostly about just using the proper angles for the rotation. Euler angles have the possibility of locking very easily so it is always good to check the results with actual parts or try other rotations.
Rotation about the X axis by -65°
Result: -65, 0, 0
Rotation about the Y axis by 90°
Result: 0, 90, -65
Rotation about the Z axis by -65°
Result: 0, 90, -130
Notice how when you rotate about the Y axis, you immediately lose that X rotation!!
Here are the results of that same rotation, but applied in X, Z, Y order:
Rotation about the X axis by -65°
Result: -65, 0, 0
Rotation about the Z axis by -65°
Result: -65, 0, -65
Rotation about the Y axis by 90°
Result: 22.52, 27.23, -78.85
Rotate a part in the way you want it to be rotated. Then, use those same values in your orientation.
You can use the debugger if you want to see what happens to the values. If it helps, Orientation applies rotations in Y, X, Z order, which can be used with CFrame.fromEulerAnglesYXZ(Y, X, Z)
Try using the above solution instead. This is also very useful when dealing with things like Cameras, because they will have improper rotations if applying them in the wrong order.
Example: https://i.gyazo.com/b142157632b1c08e6c7a40cc124813a9.mp4
Left-side camera is tilted while the right-sided one is properly rotated.
Both are using <65, 90, 0>, but the order in which the rotations happen change. (X, Y, Z vs Y, X, Z)