Hello guys. I’m making my plugin. I almost finished rotational handles, but got one problem:
this handles work with CFrames, while people should input plane’s ROTATION (vector3) into 3-input slots:

When I try to convert CFrame to rotation, it work only sometimes. In most cases, it goes crazy, have inverted rotation, etc.

Can someone tell me, how I can convert CFrame to Rotation, and back properly?

I don’t entirely understand why you need to convert CFrame to rotation and back, so let me know if I didn’t quite answer your question.

CFrames are comprised of a position vector and a 3x3 rotation matrix for a total of 12 values. To obtain the position/rotation values of a CFrame you can use CFrame.Position or CFrame.Rotation. If you want all 12 values, you can use CFrame:GetComponents(). One thing to note, which may be your issue, is that CFrame.Rotationdoes not return a vector. CFrame.Rotation returns “a copy of the CFrame with no translation.” If you didn’t already know, you would normally apply rotation by multiplying CFrame.Angles. Since this is already a CFrame, you can just multiply it outright. Here’s how that would look when copying a CFrame to another part after separating position and rotation.

local currentPosition = workspace.Part1.CFrame.Position
local currentRotation = workspace.Part1.CFrame.Rotation
workspace.Part2.CFrame = CFrame.new(currentPosition) * currentRotation

As for applying rotation values that a user inputs, you’ll want to multiply CFrame.Angles. That would look like the following.

local currentPosition = workspace.Part.CFrame.Position
local xInput, yInput, zInput = 30, 60, 90
workspace.Part.CFrame = CFrame.new(currentPosition) * CFrame.Angles(xInput, yInput, zInput)

You can also leave out the position and just keep CFrame.Angles, since it’s the same.

Hello, thank for this explanations (but I need diffirent thing)

I have this handles for rotating object:

They work with CFrame of plane (that white orb)

Also I have manual value inputs:

Which should behave like this built-in params (yellow dots):

Both this tabs control how Plane will be locked in workspace, so if there’s Position 0, 60, 30 and rotation 30, 0, 0, plane center will be locked to CFrame (0, 60, 30, 1, 0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388)

When I try rotate smth with my handles, it should show resulted rotation in this Rotation tab.

But when I try make this, I run into problems where I incorrectly transform CFrame’s Rotation into Orientation Vector3, which result in incorrect plane:

(you can see here that grid plane is in incorrect rotation, after rotating white orb with handles, that’s because I incorrectly calculated Orientation Vector3, which I utilize in plane positioning)

After long look into my code, I solved my problem. It was caused by this:

I mixed CFrame.Angles() with Orientation Vector3, which inputted in that 3-inputs. Because of their diffirence in rotation order, I got incorrect results.