Placement system collides with objects touching the surface of other objects

My script counts objects that are touching the surface of the hitbox as colliding, I researched for a solution but couldn’t find any devforum posts, etc. I don’t know how to approach this problem so some helpful advice would be appreciated!

Video:

Video showcasing issue

Script

Important part of script

local cframe =  CFrame.new(newlocation) * newrotation
model:PivotTo(cframe)
local parttable = game.Workspace:GetPartBoundsInBox(model.WorldPivot, model.Hitbox.Size)
			local found = false
			for i,v in pairs(parttable) do
				if v == game.Workspace.World.Baseplate then
					found = true
				end
			end
			if not found or #parttable > 1 then
				highlight.FillColor = Color3.fromRGB(255, 11, 0)
			else
				highlight.FillColor = Color3.fromRGB(0, 237, 4)
			end

Some extra information, the parts are on a grid (math.round) and only the surface is touching.

Maybe try instead of GetPartBoundsInBox the function GetPartsInPart and if it finds something, you can’t place it

1 Like

Thanks, it works! Much appreciated

1 Like

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