How to convert CFrame.Angles to global rotation

		handle.MouseDrag:Connect(function(axis, relativeAngle, deltaRadius)
			local axisAngle = Vector3.FromAxis(axis)
			axisAngle = axisAngle * relativeAngle
			
			for i,v in pairs(SelectedObjects) do
				local LastCFrame = v:FindFirstChild("LastCFrame").Value
				
				v.CFrame = LastCFrame * CFrame.Angles(axisAngle.X, axisAngle.Y, axisAngle.Z)
			end
			
		end)

This script shows how I’m using ArcHandles to rotate a part. The problem is that the part is using local rotation, and I need it to use global rotation. I’ve looked at other posts on the devforum which say to use :ToWorldSpace, but that hasn’t worked for me

1 Like

In cf1 * cf2 (equal to as cf1:ToWorldSpace(cf2)), cf1 defines a coordinate system and cf2 defines an offset on/around the axes of that coordinate system.

When CFrame.Angles is the second CFrame in the calculation, it defines a rotation offset around the axes of LastCFrame, and the Rotation matrix of LastCFrame defines the rotations around the world axes (which are applied before the rotation offset).

When having CFrame.Angles first in the calculation and the rotation of LastCFrame second, CFrame.Angles defines the initial rotation around the world axes and the rotation matrix of LastCFrame defines the offset on the axes of this rotated coordinate system defined by CFrame.Angles.

Try this code.

v.CFrame = CFrame.Angles(axisAngle.X, axisAngle.Y, axisAngle.Z) * LastCFrame.Rotation + LastCFrame.Position
1 Like

Sorry for responding late, this absolutely works, thank you for the help. Quick question though, what is a rotation matrix?

CFrames are matrices that contain four vectors: a position vector and three rotation vectors that are perpendicular to each other. With a rotation matrix I mean a CFrame in which the position is (0, 0, 0). So the rotation matrix of a CFrame cf is cf - cf.Position.

The rotation vectors define the directions of the axes of the coordinate system defined by a CFrame. Here’s a link to my post that has a short explanation about CFrames.

1 Like

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