Collisions do not respect `BasePart.CollisionGroup`

The BasePart.CollisionGroup property does not do anything in the Roblox physics engine. All setting this property does is trigger an internal callback to set the BasePart.CollisionGroupId, which was deprecated in favor of BasePart.CollisionGroup. The deprecated BasePart.CollisionGroupId is the property that is actually used for collision detection, and it is extremely easy to desync these two values. To desync the two values, set the CollisionGroupId of a BasePart to a collision group ID that does not match the CollisionGroup set to the BasePart. Once desynced, the properties can be re-synced by either setting BasePart.CollisionGroupId to match the BasePart.CollisionGroup’s ID, or by setting BasePart.CollisionGroup to a different value. Setting BasePart.CollisionGroup to its current value without changing it will not reset the BasePart.CollisionGroupId and thus will not do anything to remedy desynced collision behavior. Attached is a reproduction file with a part and GUI buttons to change the part’s collision behavior with the player character.

collisiongrouprepro.rbxl (62.0 KB)

Expected behavior

The behavior should be reversed. Changing BasePart.CollisionGroupId should do nothing but update the BasePart.CollisionGroup, and BasePart.CollisionGroup should be the property used for collisions. Normally, this would not be a worthwhile bug to fix because it only appears to trigger when modifying deprecated properties, but importing models from other places will use the original place’s BasePart.CollisionGroup and BasePart.CollisionGroupId values, resulting in desyncs between places with the same collision group names and different IDs, with no deprecated properties updated by the developer. This is how I discovered this bug in the first place.

4 Likes

So the problem is that setting the CollisionGroupId doesn’t update the CollisionGroup property?