GetPartsInBoundingBox / GetPartsInPart inaccuracies

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.
image

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:
image
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
2 Likes

from what i know Spatial Api also counts objects that intersect to collision, try to make bounding box border a little bit smaller or bigger to see if it would work then

1 Like

I don’t understand what you mean? I can’t really make sense of what your reply means, no offense.
Making the bounding box border smaller or bigger won’t change anything.

1 Like

I believe this issue may be solved.

After also giving the spatial query function an OverlapParams such as this:

local BoundsParams = OverlapParams.new()
BoundsParams.BruteForceAllSlow = true

the problem appears to have been fixed.

I’m going to do some testing and if this solves the issue I’ll mark this reply as solution.

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