What do you want to achieve? Make a dragged part slide on the wall or table to player’s mouse so it won’t stuck
What is the issue? Include screenshots / videos if possible!
What solutions have you tried so far? I’ve tried using raycasting but it only broke it even more
I was trying to make a dragging system, so far it works well… Until you face a wall or any other object that can make draggable part stuck.
The way this script works is it creates AlignPosition (and AlignOrientation) and DragPart which holds second attachment for AlignPosition.
DragPart is what makes Draggable Objects move and rotate accordingly to it via this part of the script:
local dir = (Head.CFrame.Position) + ((mouse.Hit.Position - Head.CFrame.Position).Unit * dist) local x,y,z = cam.CFrame:ToOrientation() local cf = CFrame.new(dir) * CFrame.Angles(cam.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(rOffset.X,rOffset.Y,rOffset.Z) dragPart.CFrame = cf * CFrame.new(offset)
It would be great if someone explained to me the magic of raycasting or anything else that could make the part slide left, right, up or down the wall so it would unstuck
it also doesn’t slide on the table, I assume because the DragPart is inside the table and dragging part is trying to get inside the table.