Right now, there’s this annoying pattern where you have to* loop in PhysicsService to set a part’s collision group. That’s pretty annoying, and it seems to me that there’s no good reason this can’t be a first-class interface on the BasePart.
The recommended and canonical pattern is relatively equivalent to what a BasePart-level API would give you. First time I’ve heard a developer setting a CollisionGroup this way, setting the CollisionGroupId. If you already have the name, there’s SetPartCollisionGroup.
-- Recommended pattern
for _, basePart in ipairs(model:GetDescendants()) do
if basePart:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(basePart, "FooGroup")
end
end
-- BasePart-level API
for _, basePart in ipairs(model:GetDescendants()) do
if basePart:IsA("BasePart") then
basePart:SetCollisionGroup("FooGroup")
end
end
Sort of seems like API bloat to cut off a little bit of typing for a pattern that can already be used. Though I get the idea behind this request is so that you don’t have to use PhysicsService, it just seems like a needless abstraction?