Is CFrame.Angles() broken?

I don’t understand what is going on with CFrames, but I just want to use them to set the position and orientation of parts.
For some reason whenever I try adjusting the CFrame with a script it isn’t accurate to the point when it’s unusable.


As you can see I tried rotating the part with a little line of code, but after a look on the properties you can see that the Orientation isn’t accurate at all.
I tried it in the most different scenarious and instances, but whenever you use code to adjust the Orientation with CFrame.Angles() it doesn’t work.

2 Likes

I believe you should be using CFrame.fromEulerAnglesYXZ(), CFrame.Angles() works differently (matrix stuff)

1 Like

Alright, I got it! But is there a way of doing it with CFrame.Angles()?

You need to convert it into radians. For example if you wanted to rotate a part with CFrame on the x axis by 45 you would need to do

Part.CFrame *= CFrame.Angles(math.rad(45),0,0)
1 Like

If you take a closer look to the command I tried to run in the command bar you can see that I actually did use math,rad(), but thank you for the tip.

Ah. Sorry I didn’t notice that.

Update, it didn’t work either.

try part.CFrame = part.CFrame * CFrame.Angles()

I didn’t say to use that. You cannot use it with CFrame.Angles(), CFrame.fromEulerAnglesYXZ() is just another way of constructing a rotation matrix.

Not really, If you want to do it with CFrame .angles it’s more YXZ is orientation, XYZ is CFrame.angles order.

To force it to apply it on the Y axis first you can do this:

part.CFrame = CFrame.new(10,10,10)*CFrame.Angles(0,math.rad(30),0)*CFrame.Angles(math.rad(15),0,math.rad(45))

TBH just use CFrame.fromOrientation()

1 Like

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