How to change the shape of a ray (kinda)

I am creating a dragging system for my Factory Simulator game, I want to change the ray that determines the location of where a dragger part is located based on mouse position and camera angle.

Heres a reference of what I made, the purple dot is the dragger object, which synced with a goal part using some physics instances:

Heres a more detailed view, with the dotted line being where the ray can be on a 2D plane (just for refrence):

Heres what I really want:

He is the line of code that really determines everything:

		local CF = CFrame.new(Player.Character.Head.Position, Mouse.Hit.Position)
		DragBall.GoalPart.CFrame = CFrame.new((CF + (CF.LookVector * 10)).Position) * workspace.CurrentCamera.CFrame.Rotation

Not sure where to start, any thoughts?

Have you taken a look at using DragDetectors? The DragLimits property can help clamp the position like you want

How would I implement this even?

idk how optimal it is, but the intuitive solution is to raycast down and just, change the goal to be slightly above the hit point

1 Like