Weird Inconsistent Drag Detector Behaviour

Drag detectors are being weird for me. In this below video, once the object reaches the max angle of 90 degrees, it won’t allow me to rotate it back the other way and instead will drag the object into the wall instead. Very strange

It’s hard to explain in words hence the video. It’s quite strange and I don’t know if this is something to do with my properties, code, or perhaps a bug. I’ve also tried this in-game instead of studio and the same results occur.

In this below video, even stranger behavior occurs when I set the ReferenceInstance of the DragDetector to it’s parent.
The drag detector is parented to an invisible part which is welded to the lever object

In this video it stops halfway, and it says the angle is at 90 when it’s not.

Here’s a snippet of my code incase that has to do with anything. I don’t think it does, I think something is wrong with my properties.

local drag = handle:FindFirstChildWhichIsA('DragDetector')
if not drag then drag = assets.DragDetector:Clone() end
drag.ReferenceInstance = handle -- the invisible part
drag.Enabled = true
drag.Parent = handle
	
handle.Weld.Part1.Anchored = false -- Part1 is the orange lever object itself, not the invisible part.
	
local isUp = self.Model:GetAttribute('DefaultStateIsUp') -- this just determines whether or not the lever should start in the up position or not
drag.DragFrame = CFrame.fromOrientation(math.rad((isUp and drag.MaxDragAngle or drag.MinDragAngle)), 0, 0)
	
drag.DragStart:Connect(function() -- these arent anything important, just disabling a prompt when dragging and playing a sound.
	t.PlayPullSound(self.Sound)
	prompt.Enabled = false
end)
	
drag.DragEnd:Connect(function()
	self.Sound.Playing = false -- stop playing
	prompt.Enabled = true
end)
	
drag.DragContinue:Connect(function()
	if not self.HasPower then return end
	
	local x,y,z = drag.DragFrame:ToOrientation()
	local angle = math.deg(x)
	
	if (angle >= drag.MaxDragAngle or angle <= drag.MinDragAngle) then
		if self.DoDebounce() then return end
		
		t.PlayPulledSound(self.Sound)
		
		if self.Enabled == (angle >= drag.MaxDragAngle) then return end -- its already at this position, so dont bother
		self:FireAndSet(angle >= drag.MaxDragAngle) -- handles what the lever will actually do once it has been pulled
		return
	end
end)

I’ve also tested this in-game rather than studio and the same behaviour occurs. No clue what’s going on here so would appreciate if anyone knows drag detectors a bit better than me.

1 Like