Convert rotation with flipped Y and Z axis

Hello! I’m having issues with properly translating my phone rotation to a part.

The rotation returned by my phone has it Y and Z axis switched which makes the part rotation not match the phone one. To fix this i would need to switch back the two axis but just doing (X, Z, Y) leads to the part rotating on the x when the Z is more than 90 or -90.

So, how could I properly switch back the two axis whitout it doing weird things?

Thanks.

1 Like

Using ToOrientation instead of ToEulerAnglesXYZ when getting the individual axis from the CFrame looks to have fixed it.