I have been stuck on this problem for a while. What is basically hapenning is, that i have a X, Y, Z, in a vector, and i apply them into a CFrame:
local Offset = CFrame.Angles(
math.rad(RotationOffset.X),
math.rad(RotationOffset.Y),
math.rad(RotationOffset.Z)
)
I have a specific effect, that doesn’t use Z, and only X and Y, but Z is changed for some reason.
After printing this by using CFrame:ToEulerAnglesXYZ(), Z will always be 0.
Offset is equal to: (note that this is a increase of that rotation each frame)
0.001771788578480482 0.0054963212460279465 -0 at the start
0.000044158601667732 -0.00014911283506080508 -0 and this is it at the end.
everywhere in between Z is equal to 0 (or -0).
Afterwards i do this calculation: (happens each frame, DesiredCFrame only changes position in my test cases, and never changes rotation.)
local EndCFrame = DesiredCFrame * EffectsOffset
... -- EndCFrame is not affected by any way in between these lines, only used for some other calculation
Camera.CFrame = EndCFrame
But if i print the Eulerangels of the EndCFrame then:
start of the effect: -0.062286216765642166 -0.15526291728019714 -0.009644108824431896
end of the effect: -0.06207619607448578 -0.15618515014648438 -0.10972192138433456
I have not moved my camera, and everything i did, was simply add that rotational offset to a position.
This extra Z causes some unwanted screen rotation. Note that i still want you to be able to rotate in the Z direction, but when i only move my x and y, z shouldn’t move.
So when i change the X and Y, the Z also changes for no reason. This happens when the cameratype is set to scriptable.
I can also see that they slightly affect eachother. But how do i make it, so that this unwanted rotation doesn’t happen anymore.