3D Handles Dragging Accessories in Opposite Direction

Right now, we (further known as my development team) are working on an in-game customization menu, which has multiple advanced features such, including adjusting the offset, rotation and scale of an accessory.

The scale we have figured out without an issue, the problem comes with the offset, and rotation (in certain circumstances)

We currently change the accessory position (offset) through the AccessoryWeld.C1 value.

We did come to the conclusion when we set the accessories AccessoryWeld.C0 to 0,0,0 it can somewhat resolve the issue, but it causes a bit of inconvenience towards the player as they would need to rotate and offset the accessory back into its original place in-order to position it to the place they would like.

It’s a bit annoying for lets say, players want to customize their hairs, and they have to basically try and figure out how and where to place it, it causes a major issue.

We’re currently wondering if there is a way to fix the issue so that the handles actually position properly, without the issue of trying to completely change the position/rotation of the accessory, and have it still be in the same position it would be on the character by default, while having the handles actually move properly.

Is there any fix for this?

Code for reference;

local OldCFrame = CurrentAccessory.Handle.AccessoryWeld.C1
        for i, Handle in pairs(ActiveHandles) do
            local newCF
            local saveCF
            Handle.MouseDrag:Connect(function(id, distance)
                local axi = {
                    [Enum.NormalId.Right] = CurrentAccessory.Handle.AccessoryWeld.C1.RightVector,
                    [Enum.NormalId.Left] = -CurrentAccessory.Handle.AccessoryWeld.C1.RightVector,
                    [Enum.NormalId.Top] = CurrentAccessory.Handle.AccessoryWeld.C1.UpVector,
                    [Enum.NormalId.Bottom] = -CurrentAccessory.Handle.AccessoryWeld.C1.UpVector,
                    [Enum.NormalId.Front] = CurrentAccessory.Handle.AccessoryWeld.C1.LookVector,
                    [Enum.NormalId.Back] = -CurrentAccessory.Handle.AccessoryWeld.C1.LookVector
                } 
                --accessoryObject.Handle:FindFirstChildOfClass("SpecialMesh").Offset = (CF + axi[id] * (math.floor(distance / increment) * increment)).Position
                local bigfatincrement = 0.1
                newCF = OldCFrame + axi[id] * (math.floor(distance / bigfatincrement) * bigfatincrement)
                if math.abs(newCF.X) > 2.01 or math.abs(newCF.Y) > 2.01 or math.abs(newCF.Z) > 2.01 then
                    return
                end
                MainFrame.Accessories.AccessorySettings.Settings.Offset.OffsetValues.XOffset.Text = tostring(math.floor(newCF.X * 100) / 100)
                MainFrame.Accessories.AccessorySettings.Settings.Offset.OffsetValues.YOffset.Text = tostring(math.floor((newCF.Y) * 100) / 100)
                MainFrame.Accessories.AccessorySettings.Settings.Offset.OffsetValues.ZOffset.Text = tostring(math.floor(newCF.Z * 100) / 100)
                CurrentAccessory.Handle.AccessoryWeld.C1 = newCF
                saveCF = newCF
            end)
            Handle.MouseButton1Down:Connect(function()
                OldCFrame = CurrentAccessory.Handle.AccessoryWeld.C1
            end)
            Handle.MouseButton1Up:Connect(function()
                CustomizationEvents.CustomizationEvent:FireServer("MoveAccessory", CurrentAccessory, saveCF)
            end)
        end
2 Likes
newCF = OldCFrame * CFrame.new(axi[id] * (math.floor(distance / bigfatincrement) * bigfatincrement))

Try this

Still behaves the same as before as referenced in the video, nothing changed.

local axi = {
                    [Enum.NormalId.Right] = -CurrentAccessory.Handle.AccessoryWeld.C1.RightVector,
                    [Enum.NormalId.Left] = CurrentAccessory.Handle.AccessoryWeld.C1.RightVector,
                    [Enum.NormalId.Top] = -CurrentAccessory.Handle.AccessoryWeld.C1.UpVector,
                    [Enum.NormalId.Bottom] = CurrentAccessory.Handle.AccessoryWeld.C1.UpVector,
                    [Enum.NormalId.Front] = -CurrentAccessory.Handle.AccessoryWeld.C1.LookVector,
                    [Enum.NormalId.Back] = CurrentAccessory.Handle.AccessoryWeld.C1.LookVector
                } 

replace this with your axi table