Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

part constantly trys to go to a position under ground instead of staying on top of the ground?

Asked by 4 years ago

So i have this code basically it drags the part to the cameras position but going out 10 studs the thing is when you drag the mouse to the ground the part constantly glitches into it like it's trying to go to a position under it, So i know the problem but i dont know how to fix, My guesses is raycast? Or Something like MoveTo where the model automatically goes on top of the part

local bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bp.D = 700
bp.Parent = workspace.part
game:GetService("RunService").RenderStepped:Connect(function()
bp.Position = workspace.CurrentCamera.CFrame.Position + mouse.Hit.LookVector * 10
end)
0
If you want it to make the part hit the surface, then you'd use raycasting royaltoe 5144 — 4y
0
Do you need help with that? Message me on discord: Lucy#0003 royaltoe 5144 — 4y

Answer this question