CollisionGroup

class CollisionGroup(val value: UInt = COLLISION_GROUP_DEFAULT)

Categorizes entities into distinct bitmask-based groups for collision filtering.

A CollisionGroup is represented by a 32-bit unsigned integer where each bit can be treated as a separate collision category. This is used in conjunction with CollisionFilter to determine which entities should interact physically.

Usage Example:

// Define unique categories using bit shifting
val CATEGORY_FLOOR = 1u shl 0 // 0x0001
val CATEGORY_PLAYER = 1u shl 1 // 0x0002
val CATEGORY_PROJECTILE = 1u shl 2 // 0x0004

// Create a group for a specific category
val playerGroup = CollisionGroup(CATEGORY_PLAYER)

// Entities can belong to multiple categories by combining them
val playerAndProjectile = CollisionGroup(CATEGORY_PLAYER or CATEGORY_PROJECTILE)

Note: The collision detection system operates with a precision of 0.001 meters (1 millimeter). When the distance between the surfaces of two colliders is less than this threshold, the colliders are considered to be in contact.

Constructors

Link copied to clipboard
constructor(value: UInt = COLLISION_GROUP_DEFAULT)

Types

Link copied to clipboard
object Companion

The companion object of CollisionGroup.

Properties

Link copied to clipboard
val value: UInt

The bitmask value of the collision group. Defaults to COLLISION_GROUP_DEFAULT.