{still no fix :*} Placement system - collision script not working properly?

so i am working on a placement system, but the collision script is not working as intended.

here is the script, also i am using the rotated region 3 module, but i have tried the normal one and it still didnt work

local region2 = RR3.new(hitbox.CFrame,hitbox.Size-Vector3.new(0.1,0.1,0.1))
		local ignorelist = {}
		for i,v in pairs(game.Players:GetChildren()) do
		local parts2 = region2:FindPartsInRegion3WithIgnoreList(ignorelist)
		for i,v in pairs(parts2) do
			if v.Name == "Hitbox" and v ~= hitbox then
				canPlace = false

You could make the dropper Collidable with other objects already placed. I’m not sure if this would work with your system but it would be a simple solution.

not really, you could move your camera into the hitbox and still place there

I didn’t think about that, in that case it could be a issue with FindPartsInRegion3WithIgnoreList because your code looks fine.

yea, also the glitch only occurs when both hitboxes are the exact same size. if you try to place a smaller item inside of a bigger item, it wont work.

Yea so its def a FindPartsInRegion3WithIgnoreList glitch.

well, not much i can do about it then. i guess ill just wait for roblox to fix it

1 Like

Not a solution but more a suggestion. I’d rework your logic and map the entire base into a matrix instead. This would make it very easy to keep track of where your objects are located at and where you can’t / can place them.

Here’s a more feasible solution:
As you can determine if a part is within / intersecting another part.

So based on that, I’d generate a temporary part the size of the model using:

And then use the GetTouchingParts method (unless you can directly do it with the model itself).


You might want to use something like: https://developer.roblox.com/en-us/api-reference/function/BasePart/GetTouchingParts

Also I noticed the size you are searching is smaller hitbox.Size-Vector3.new(0.1,0.1,0.1), try using the normal size.

For debugging you can create a part and:

viewer = Instance.new("Part",workspace)
viewer.CFrame = RR3.CFrame
viewer.Size = RR3.Size

To see where the Region spawns in at

Use GetTouchingParts

local function GetTouchingParts(part)
	local connection = part.Touched:Connect(function() end)
	local results = part:GetTouchingParts()
	return results

local function CheckCollision(instance) 
	local IsColliding = false
	if instance:IsA("Model") then
		for _,z in pairs(instance:GetChildren()) do
			local result = GetTouchingParts(z) 
			for i,v in pairs(result) do if v:IsDescendantOf(instance) then table.remove(result,i) end end
			if #result ~= 0 then
				IsColliding = true
	if instance:IsA("BasePart") then 
		local result = GetTouchingParts(instance)
		if #result ~= 0 then IsColliding = true end

	return IsColliding

but it doesnt return parts with cancollide off right

Would this workaround solution solve that?

mm that looks interesting let me try it out

1 Like

nope the same issue is still there

Either make the actual region bigger than the bounding box, or raycast from above the object downwards to see if it hits something.

i dont think it would work with a 3 dimensional map tho

Personally i solve this by using :GetTouchingParts() and checking with it every frame while placing an object.I solve the CanCollide problem by turning on collisions right before running the check and then turning it off immediately after.

Here is an example that i use and it works perfectly:

CanPlace = true
GhostObj.Base.CanCollide = true --GhostObj is the clientside object that i move, Base is the "hitbox".
for i,v in pairs(GhostObj.Base:GetTouchingParts()) do
	if not v:IsDescendantOf(GhostObj) and v ~= workspace.Baseplate then
		CanPlace = false
GhostObj.Base.CanCollide = false

if CanPlace then
print("object is not colliding with anything")

I obviously recommend doing this same check on the server, once the player places the object. Can’t trust the client.

Hope this helps!

thanks for the reply, i do appreciate any help at all, but i have already tried and got the same result :confused:
but ill still try again just to make sure it doesnt work

You’re shrinking the size of the region to check in by v3(.1, .1, .1). I’m not sure how your Rotated Region3 module works, but it might be failing to detect the collision when both props are in the identical spot because the hitbox faces are outside of the region. (Which would be expected if the module uses raycasting for collision detection)

I use AxisAngle’s Rotated Reg3 module for placement detection. It has similar functionality to the rotated region3 module you used, but correctly detects a collision even if the part’s faces exceed the region bounds.

The syntax translates as

local region = RotatedRegion3.new(hitbox.CFrame, hitbox.Size)

local collisionParts = region:Cast(ignorelist)

for _, part in ipairs(collisionParts) do
    if v.Name == "Hitbox" and v ~= hitbox then
	canPlace = false

As an optimization for my placement system, I use region:CastParts(parts) to do a whitelisted collision check, instead of the blacklisted ignore approach. parts would be an array of all the already placed hitboxes.

1 Like