I have an issue with the dragging mechanic I want to achieve. I have a script that allows me to drag any unanchored part in the workspace, with TranslateViewPlane mode. The problem with that mode for a DragDetector is that it doesn’t necessarily follow/update its position with your view when moving.
As shown, it doesn’t follow my cursor when I change my view by moving. Is there any way to fix this?
2 Likes
You’ll need to provide the code you are using to get the part to appear in front of the player. It’s difficult to help with just a video when you don’t explain what causes the update.
The issue may come down to what you are watching for changes. Moving may not be updating that where changing your view through rotation would.
I somehow forgot the code… My bad
local function addDrag(instance:Instance)
if not instance:IsA("BasePart") then return end
if instance.Anchored then return end
local drag = script.DragDetector:Clone()
drag.Parent = instance
drag.Enabled = true
drag.DragStart:Connect(function()
instance.CanCollide = false
end)
drag.DragEnd:Connect(function()
instance.CanCollide = true
end)
end
workspace.DescendantAdded:Connect(addDrag)
for i, v in pairs(workspace:GetDescendants()) do
addDrag(v)
end
I have never worked with a DragDetector before. This is a new class to me and I did not know it existed.
Where this is a class created by Roblox and controlled solely by Roblox engineers, I recommend you post this issue in Engine Bugs - Developer Forum | Roblox. It appears that this detector only updates when your mouse moves, not when the character moves in the world like you would expect.
I am not sure how you have dragging done from the client or how Roblox replicates that. None of your code is actually moving the part.
Still having this issue… any fix?