Odd CFrame behavior?

Hi, I’ve been trying to figure out this odd issue related to CFrame that causes the expected result to be a little offset. I don’t know why it does that.

motor6d.C0 = CFrame.new(-0.246, 0.635, -0.451)*CFrame.Angles(math.rad(-9.82), math.rad(-69.081), math.rad(-10.804))

Normally, the script above should set the position and angle at the exact same numbers.

image

However the screenshot above proves that the orientation is offset by a few degrees. It’s as if some angles are either added or subtracted…

I did mess around with it and it somehow works if the X or Y angle is removed, specifically the math.rad() function.

Does anyone know a workaround this? I’m pretty sure this is a bug within CFrame.

Look’s like CFrame.fromEulerAnglesYXZ was the solution. Not sure why CFrame has alot of functions.

Don’t worry, the object should still be facing the same direction, only the representation is different.

Orientation describes Tait-Bryan angles (transformation is applied in order Y then X then Z), while CFrame.Angles() constructs Euler angles (transformation is applied in order Z then Y then X).

It’s about different rotation orders: RotationOrder | Documentation - Roblox Creator Hub

1 Like

Though you already solved this, it would be better if you set
motor6d.C0 = CFrame.new(motor6d.C0.Position)*angles because you will have to readjust it if you ever wanted to change the motor6d properties.

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