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
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.
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.