Rounding a cframe's angles in degrees?

This is the current code I have, but it seems to angle the cframe the wrong way.

Note: final_cframe is the cframe being edited here.

local x, y, z = final_cframe:ToOrientation()
x = math.rad(math.round(math.deg(x))) 
y = math.rad(math.round(math.deg(y))) 
z = math.rad(math.round(math.deg(z)))

final_cframe = CFrame.new(final_cframe.Position) * CFrame.Angles(x, y, z)

Here’s a visual of the issue.
Expected:
image

Actual Outcome:
image

1 Like

Use CFrame.fromOrientation and not CFrame.Angles

Also remember to convert it back to radians

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.