PhysicsService
PhysicsService primarily contains methods for working with collision groups which define whether a set of parts may or may not collide with parts in other collision groups. You can register a collision group through RegisterCollisionGroup() and assign parts to it by setting those parts' CollisionGroup property to the name of the collision group.
Creating, deleting, and modifying collision relationships between collision groups is limited to server-side Scripts.
See Collision Filtering for usage details in Studio and within scripts.
Summary
Methods
Sets the collision status between two groups.
Returns whether the two groups will collide.
Returns the maximum number of collision groups.
Returns a table with info on all of the place's collision groups.
Checks if a collision group is registered.
Registers a new collision group with the given name.
Renames specified collision group.
Unregisters the collision group for the given name.
Properties
Methods
RegisterCollisionGroup
Parameters
Returns
Code Samples
local PhysicsService = game:GetService("PhysicsService")
local collisionGroupBall = "CollisionGroupBall"
local collisionGroupDoor = "CollisionGroupDoor"
-- Register collision groups
PhysicsService:RegisterCollisionGroup(collisionGroupBall)
PhysicsService:RegisterCollisionGroup(collisionGroupDoor)
-- Assign parts to collision groups
script.Parent.BallPart.CollisionGroup = collisionGroupBall
script.Parent.DoorPart.CollisionGroup = collisionGroupDoor
-- Set groups as non-collidable with each other and check the result
PhysicsService:CollisionGroupSetCollidable(collisionGroupBall, collisionGroupDoor, false)
print(PhysicsService:CollisionGroupsAreCollidable(collisionGroupBall, collisionGroupDoor)) --> false