How to Convert Orientation to CFrame.Angles?

I was trying to change the orientation of an NPC’s arm to (57.88, -71.31, -25.83) by using CFrame.Angles.

By using this line of code

lArm.CFrame = aimer.CFrame * CFrame.new(-0.787,0.207,-0.92) * CFrame.Angles(math.rad(57.88),math.rad(-71.31),math.rad(-25.83))

I was able to change the CFrame position but not the CFrame rotation to the correct value.

Is there a way to convert orientation to CFrame.Angles?

1 Like

CFrame.fromOrientation()

CFrame.Angles is the same as fromEulerAnglesXYZ which is not the same as the rotation is applied in a different order

6 Likes

So I did this,

lArm.CFrame = aimer.CFrame * CFrame.new(-0.787,0.207,-0.92) * CFrame.fromOrientation(57.88,-71.31,-25.83)

But the orientation came out to be (76.28, -125.76, -39.95).

1 Like

fromOrientation expects values in radians.

7 Likes