FYI: This may be a bug related to how these functions operate, I’m not sure
I have been attempting to use the functions stated in the topic title to check if a new hallway can be placed in a region in front of a previous one.
I have begun to notice inaccuracies with this system where sometimes for seemingly no reason hallways will still intersect, and I don’t see any errors within my code which would explain why this is happening, so I’m assuming it’s a bug with these functions.
As demonstrated here, rooms intersect.
If you think there is an error somewhere within my code or know a different solution for what I’m trying to do, I would be grateful if you could reply with your solution, I’ll get back to you with how it went when I can.
I have tried GetPartsInPart as well, same results.
I am also certain that I’m sending the correct data to this function, and I believe this since I have also visualized the boxes which I’m using to detect hallways and they intersect eachother.
Pictured here:
Red = intersecting (added manually)
White = visualization parts
Thanks!
Detection function:
local function CheckBounds(NewCF: CFrame, Size: Vector3): boolean
-- .005 instead of the initial size since otherwise it will detect hallways which don't intersect the box
for _, Var in ipairs(workspace:GetPartBoundsInBox(NewCF, Size - Vector3.new(0.005, 0.005, 0.005))) do
if Var:IsA("BasePart") and Var.Name == "Hitbox" then
return false
end
end
return true
end