How to set a specific orientation of a CFrame value

When making a CFrame value, I need the Orientation to be Vector3.new(0, 90, 0)

RightRotateV.C0 = CFrame.new(RightRotateV.C0.Position, Vector3.new(0, 90, 0))

The issue with this is the 2nd parameter for CFrame.new is where you want to part to be looking at, not the orientation value. So instead of making the orientation equal to 0, 90, 0 the script is making the part look at the position 0, 90, 0

You could just set the first parameter for the position, leave the second parameter blank, and then multiple the first cframe by cframe.angles to get it to rotate

RightRotateV.C0 = CFrame.new(RightRotateV.C0.Position) * CFrame.Angles(0,math.rad(90),0)

Could be a simpler way to do it, but that’s worked for me in the past

workspace.TestPart1.CFrame = CFrame.new(workspace.TestPart1.Position) * CFrame.Angles(math.rad(90), math.rad(90), 0)

I tested this out on a part and it works with CFrame.Angles(0, math.rad(90), 0) but in the code I wrote above, the orientation gets set to (0, 90, 90) instead of (90, 90, 0)

Try using math.rad(-90) so it rotates in the opposite direction

I’m not an expert with CFrames myself, I can tinker with them enough to get them to work how I want, but it takes a bit of trial and error

I’ll mess with this a bit, I just think roblox’s rotation system is super weird lol. Instead of having one vector rotation be from 0-360 degrees, it’s -180 to 180 and it makes for some pretty weird glitches sometimes

1 Like

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