The title speaks for itself. I am making a building system and I don’t want parts intersecting with other parts. Currently, I am using raycasting and I am making a hitbox for each part in the workspace. The only problem is that the hitbox making is really non-efficient. How would I check if a part is intersecting with another part and not use raycasting and hitboxes?
Alternatively, you can use this bit of code to create a region3 within a part:
local part= -- the part you want the region to scan for parts inside of.
local min,max = Vector3.new(part.Position.X-part.Size.X/2, part.Position.Y-part.Size.Y/2, part.Position.Z-part.Size.Z/2), Vector3.new(part.Position.X+part.Size.X/2, part.Position.Y+part.Size.Y/2, part.Position.Z+part.Size.Z/2)
local region = Region3.new(min, max)
After that you can scan for parts inside using this
local parts = workspace:FindPartsInRegion3(region) --Returns an array of parts inside the region