InteractionGroup

data class InteractionGroup(val memberships: InteractionField, val filter: InteractionField)

Specifies which Colliders a collider will collide with, by using bit masks of InteractionLayers. This object stores two InteractionFields:

  • memberships - which layers this collider is a part of

  • filter - which layers this collider may collide with

If a collider collides with layer X, it means that the collider will collide with any others which have bit X set in their memberships field.

If we want to specify a collider which is part of the layers [0, 2, 3] and can collide with the layers [2], we specify the fields as:

          index  3 2 1 0
memberships 1 1 0 1
filter 0 1 0 0

which is written as

InteractionGroup(
memberships = InteractionField.fromRaw(0b1101),
filter = InteractionField.fromRaw(0b0100),
)

For details on what this interaction group will do exactly, see Collider.

Parameters

memberships

Which layers this collider is a part of.

filter

Which layers this collider may collide with.

Constructors

Link copied to clipboard
constructor(memberships: InteractionField, filter: InteractionField)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard