Reproduction Steps
1. Create overlapparams and set the collision group you want to detect
2. Make sure the part you want to test is set to the collision group
3. Have another part close to the part above, set to a different collision group
4. Call workspace:GetPartBoundsInBox on the area that contains the part, making sure overlapparams is included
5. See that the result returns the part at step 3 too.
Alternatively, just create a new place, create a script in workplace, then paste the code below and run it:
local collisionGroupToIncludeId = game.PhysicsService:CreateCollisionGroup("IncludeCollisionGroup")
--create a part that needs to be included when testing GetPartBoundsInBox
local PartToInclude = Instance.new("Part")
PartToInclude.Size = Vector3.new(5, 5, 5)
PartToInclude.Position = Vector3.new(1, 1, 1)
PartToInclude.Name = "PartToInclude"
PartToInclude.Anchored = true
PartToInclude.BrickColor = BrickColor.new("Camo")
PartToInclude.CollisionGroupId = collisionGroupToIncludeId
PartToInclude.Parent = workspace
--create a part that needs to be excluded when testing GetPartBoundsInBox
local PartToIgnore = Instance.new("Part")
PartToIgnore.Size = Vector3.new(5, 5, 5)
PartToIgnore.Position = Vector3.new(6, 6, 6)
PartToIgnore.Name = "PartToExclude"
PartToIgnore.Anchored = true
PartToIgnore.BrickColor = BrickColor.new("Gold")
PartToIgnore.Parent = workspace
--test GetPartBoundsInBox!
local checkOverlapParams = OverlapParams.new()
checkOverlapParams.CollisionGroup = "IncludeCollisionGroup"
while task.wait(1) do
--cast a wide net
local totalPartsCollidedTable = workspace:GetPartBoundsInBox(CFrame.new(Vector3.new(0, 0, 0)), Vector3.new(100, 100, 100), checkOverlapParams)
for i, v in ipairs(totalPartsCollidedTable ) do
print(v.Name.." detected")
if v == PartToIgnore then
print("BUG: ".. v.Name.. " should be ignored based on OverlapParams.CollisionGroup but was detected")
end
end
end
CPU - 11th Gen Intel(R) Core™ i9-11900H @ 2.50GHz
GPU 1 - NVIDIA GeForce RTX 3060 Laptop GPU
Memory - 16.0 GB
Expected Behavior
Only parts that match the CollisionGroup in OverlapParams should be returned
Actual Behavior
All parts are returned regardless of CollisionGroup in OverlapParams
Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly
Date First Experienced: 2022-07-19 13:07:00 (+10:00)