Detecting Collision on Cloned Item

I am cloning items out of Replicated Storage, slightly up in the air. I would then like them to fall to the ground and become anchored once they hit the ground.

In the screenshot, you can see a gray box on the ground. Right now, I am spawning them within that boundary.

However, the items seem to think they have collided long before they actually do – and the items end up floating in the air.

clone.Parent = rocksOnMap
clone.Position = randomPos

local connection
connection = game:GetService("RunService").Heartbeat:Connect(function()
	local touching = workspace:GetPartsInPart(clone)
	if #touching > 0 then
		for a, b in touching do
			if b == playableArea then
				clone.Anchored = true
				--print(clone.Position.Y)
				connection:Disconnect()
			end
		end
	end
	
end)

Any ideas?

Might be better to find the final position by raycasting down from the drop point then simulating the falling motion using a tween.

As Azqjanna mentioned raycasting is the right choice. The raycasting method is used in this game, so you can see it in action. Time Hunting - Roblox

You can use raycasts like the others mentioned to achieve what you want.

Example video:

Placefile:
PartPlacementRaycast Test.rbxl (41.1 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.