Inconsistency in checking bounds between GetPartBoundsInBox and GetPartsInPart

Whilst writing a basic collision detector, I noticed there are some inconsistencies between two of the Spatial Query APIs.

local cf, sz = workspace.Model:GetBoundingBox()
print(workspace:GetPartBoundsInBox(cf, sz))

local checkPart = Instance.new("Part")
checkPart.CFrame = cf
checkPart.Size = sz

print(workspace:GetPartsInPart(checkPart))

Using the exact same CFrame and Size for both a Box check and Part check, they return different values. To clarify, the part is directly atop the baseplate part.

I have accepted this and will be using GetPartsInPart to not be returned baseplate constantly, but am wondering why this occurs? Thanks.

I did some small research and what I got from it is that workspace:GetPartBoundsInBox will return anything whose bounds intersect the specific cfame and size, but workspace:GetPartsInPart will return all the parts that have their whole volume inside of the specified part.

So in your case, the model part shares bounds with the baseplate on it’s lower face, but the baseplate does not fully exist within the model part

1 Like

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