I’m interested in making a drag system simlar to the one present in Work At A Pizza Place
I’ve been through the Devforum, looking for specific topics that may fit what I’m looking for but it seems that nobody else has had the same interests with DragDetectors, I’ve also been through “DragDetectors TestWorld 1 and 2” which came up with the following from TestWorld 2:
TestWorld Snapping Script
local ScriptableDragStyleExampleUtils = {}
local cachedHitPoint = Vector3.zero
local cachedHitNormal = Vector3.yAxis
function ScriptableDragStyleExampleUtils.followTheCursor(cursorRay, dragDetector)
-- intersect with scene, excluding the folder containing this object
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {dragDetector.Parent}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local hitPoint = Vector3.zero
local hitNormal = Vector3.yAxis
local raycastResult = workspace:Raycast(cursorRay.Origin, cursorRay.Direction, raycastParams)
if raycastResult then
hitPoint = raycastResult.Position
hitNormal = raycastResult.Normal.Unit
else
hitPoint = cachedHitPoint
hitNormal = cachedHitNormal
-- warn("No raycast result!")
end
cachedHitPoint = hitPoint
cachedHitNormal = hitNormal
local lookDir1 = hitNormal:Cross(Vector3.xAxis)
local lookDir2 = hitNormal:Cross(Vector3.yAxis)
local lookDir = if lookDir1.Magnitude > lookDir2.Magnitude then lookDir1.Unit else lookDir2.Unit
return CFrame.lookAt(hitPoint, hitPoint + lookDir, hitNormal)
end
return ScriptableDragStyleExampleUtils
Which only results in the part’s upper face facing outward + the collision being weird, with my lack of math knowledge I can’t really edit this to be fit for what I’m trying to do.
Expected Results
1 - Expected Result
https://www.youtube.com/watch?v=CQ2DtqRlZGA
2 - Unwanted Result
https://www.youtube.com/watch?v=6O0sYoVktKE
Should I just be using objects like ClickDetector and implementing a custom drag or can the modern technologies of DragDetectors help me?