I have a DragDetector, with everything scriptable
self.DragDetector.DragStyle = Enum.DragDetectorDragStyle.Scriptable
self.DragDetector.PermissionPolicy = Enum.DragDetectorPermissionPolicy.Scriptable
self.DragDetector.ResponseStyle = Enum.DragDetectorResponseStyle.Custom
self.DragDetector.DragStart:Connect(function(playerWhoDragged: Player, _, viewFrame: CFrame)
local LookAttachment = GetLookAttachment(playerWhoDragged)
if LookAttachment then
self.AlignOrientation.CFrame = self.Instance.CFrame.Rotation
self.AlignOrientation.Enabled = true
local Y = viewFrame.LookVector.Y
LookAttachment.CFrame = CFrame.new(Vector3.new(0, (Y * 8) + 1, -8))
self.AlignPosition.Attachment1 = LookAttachment
self.AlignPosition.Enabled = true
self.Instance:SetAttribute("CurrentDrag", playerWhoDragged.UserId)
end
end)
self.DragDetector.DragContinue:Connect(function(playerWhoDragged: Player, _, viewFrame: CFrame)
local LookAttachment = GetLookAttachment(playerWhoDragged)
if LookAttachment then
local Y = viewFrame.LookVector.Y
LookAttachment.CFrame = CFrame.new(Vector3.new(0, (Y * 8) + 1, -8))
end
end)
self.DragDetector.DragEnd:Connect(function()
self.AlignPosition.Enabled = false
self.AlignPosition.Attachment1 = nil
self.AlignOrientation.Enabled = false
self.Instance.AssemblyLinearVelocity = Vector3.zero
self.Instance.AssemblyAngularVelocity = Vector3.zero
self.Instance:SetAttribute("CurrentDrag", nil)
end)
self.DragDetector:SetPermissionPolicyFunction(function()
if not self.Instance:GetAttribute("CurrentDrag") then
return true
end
return false
end)
It’s acting unnatural tho
It goes through anchored parts and is affecting unanchored parts?
I don’t want it to clip through ANYTHING. And I don’t want it to affect unanchored parts too (or any part thats got constraints/etc)
Unsure if using AlignPosition is the issue here? maybe I should just be setting the CFrame/lerping?