Help with rotating a CFrame right like parts orientation

what I’m trying to to do is rotate a CFrame correctly this means I cant use CFrame.Angles because it does not rotate a CFrame like orientation. an example of what It does that I don’t want it to do is when I set CFrame.Angles to rotate to 50 on the X axis and 40 on the Y axis it does not just set the parts X Orientations to 50 and the parts Y orientations to 40 but it also changes the Z orientation which I don’t want. I only want the CFrame to move to the angle I set like it does in the parts orientation property how would I do this/How would I set a CFrames rotation without CFrame.Angles and CFrame.CFrame.fromEulerAnglesXYZ or CFrame.new(Vector3.new (pos), Vector3.new(pos))

2 Likes

Why don’t you want to use CFrame.Angles? If you did use CFrame.Angles then you could use radians to convert frame into degrees. The following would rotate a part 90 degrees:

part.CFrame = part.CFrame * CFrame.Angles(math.rad(90),0,0)
3 Likes

Yes I know, but that’s not the problem CFrame.Angles causes the part to rotate on all 3 axis when i only want it to rotate on 2. I know I was not clear that I just want the CFrame rotation value to == the same as the parts orientation would if I set them both to X = 50 Y = 40 Z = 0. this works for orientation but if i do the same for CFrame.Angles it sets the z axis in the rotation

If you want to work with CFrame like Orientation, why not just use CFrame.fromOrientation?

part.CFrame = CFrame.fromOrientation(math.rad(90),0,0)
9 Likes

Yes that works how I wanted it to thanks! I missed it on the Roblox wiki for some reason or it just gives a bad description of what it does but the name is self explanatory.

This would turn it clockwise or anticlockwise? The documentation had be a small bit confused. If I wanted the opposite rotation motion, would I have a negative value on the math.rad() and what it be on the inside number or encasing the parenthesis around it?