Region3 detecting which side the part is colliding from

i am working on a placement system and i need to fix collisions so something like this cant happen:
image
and i was thinking of regions3. i just dont know if it is possible to detect which side the part is colliding from, for example: if the part is colliding from the top, it would return Top. is that possible at all? if not, then how could i deal with that issue?

No, don’t use Region3. Use :GetTouchingParts().

There is one caveat for this though (and one that should probably be fixed by Roblox). Detecting touching parts of non-collidable objects is a bit funky.

This little snippet of code takes that into consideration:

local model = --[[ Enter model path here --]]
local part = model.PrimaryPart

local conn = part.Touched:Connect(function() end)

local colliding = false
for _, otherPart in pairs(part:GetTouchingParts()) do
      if otherPart and otherPart:IsA("BasePart") and not otherPart:IsDescendantOf(model) then
            colliding = true
            break
      end
end

conn:Disconnect()
1 Like

its late now so i am gonna check that out tomorrow, and try my best

Try using raycasts? You can check if there’s a part above by shooting a ray upwards.

1 Like

that wouldnt work since the part could be colliding in the corner