参考
https://create.roblox.com/docs/ja-jp/reference/engine/classes/PhysicsService#RegisterCollisionGroup
Script:
local PhysicsService = game:GetService("PhysicsService")
local CustomCollisionGroupName = "Custom"
PhysicsService:RegisterCollisionGroup(CustomCollisionGroupName)
--PhysicsService:CollisionGroupSetCollidable(CustomCollisionGroupName, "Default", false)
PhysicsService:CollisionGroupSetCollidable(CustomCollisionGroupName, CustomCollisionGroupName, false)
local TargetObject = script.Parent
local function setCollisionGroup(object)
if object:IsA("BasePart") then
object.CollisionGroup = CustomCollisionGroupName
end
end
local function setCollisionGroupRecursive(object)
setCollisionGroup(object)
for _, child in ipairs(object:GetChildren()) do
setCollisionGroupRecursive(child)
end
end
setCollisionGroupRecursive(TargetObject)