I’m using the Dragger object for building in my game, it worked fine for a while, but at some point I couldn’t get parts to join together when dragging them onto each other. When two joinable surfaces come in contact they don’t stick.
I don’t think it’s my code, but I wouldn’t be unhappy if it was. I stripped down my code and created a simple repro.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Dragger = Instance.new("Dragger")
function isSelectable(part)
if part and part.Locked == false then
return true
end
end
mouse.Button1Down:connect(function()
local target = mouse.Target
if isSelectable(target) then
Down = true
Dragger:MouseDown(target,target.Position - mouse.Hit.p,{target})
end
end)
mouse.Move:connect(function()
if Down then
Dragger:MouseMove(mouse.UnitRay)
end
end)
mouse.Button1Up:connect(function()
if Down then
Down = false
Dragger:MouseUp()
end
end)
mouse.KeyDown:connect(function(key)
if key == "r" then
Dragger:AxisRotate("Z")-- Dragger:AxisRotate(Enum.Axis.Z)
elseif key == "t" then
Dragger:AxisRotate("Y")--Dragger:AxisRotate(Enum.Axis.Y)
end
end)
What is happening is the the dragger is placing the surfaces the tiniest bit apart, causing for the surface join to fail.
I had this happen when I was making a build to survive game, ended up having to use physical welds to join the parts.
That must be it, I could see the parts settling slightly when letting go, but I couldn’t visibly see the gap, so it must be pretty small. I hope this can be fixed, I’ve tried scripting my own dragger, but I can’t figure out the math.
I decided to measure this gap and found the distance from the surface to be 0.245 while dragging and the resting distance 0.23 making for a 0.015 stud gap. This is what a 0.015 stud gap looks like and definitely explains why parts aren’t joining.
This issue is starting to become more urgent as I continue development… It kind breaks the primary mechanic of my game.
I finally figured out what was causing the issue and how to fix it. The Join setting in the Tools section of ribbon bar affects the dragger objects ability to join parts together. Having the setting set to ‘Never’ interferes with it’s normal behavior, but having it set to ‘Surface Only’ fixes it.
I wish I could have figured that out sooner and I apparently neglected to test the issue on a live server because this issues doesn’t seem to occur there.