interactionGroups(memberships: number | number[], filters?: number | number[]): number
Calculates an InteractionGroup bitmask for use in the collisionGroups or solverGroups
properties of RigidBody or Collider components. The first argument represents a list of
groups the entity is in (expressed as numbers from 0 to 15). The second argument is a list
of groups that will be filtered against. When it is omitted, all groups are filtered against.
Example
A RigidBody that is member of group 0 and will collide with everything from groups 0 and 1:
Calculates an InteractionGroup bitmask for use in the
collisionGroups
orsolverGroups
properties of RigidBody or Collider components. The first argument represents a list of groups the entity is in (expressed as numbers from 0 to 15). The second argument is a list of groups that will be filtered against. When it is omitted, all groups are filtered against.Example
A RigidBody that is member of group 0 and will collide with everything from groups 0 and 1:
A RigidBody that is member of groups 0 and 1 and will collide with everything else:
A RigidBody that is member of groups 0 and 1 and will not collide with anything:
Please note that Rapier needs interaction filters to evaluate to true between both colliding entities for collision events to trigger.
Returns
An InteractionGroup bitmask.