Colliders
Each physics entity needs at least one collider shape alongside its RigidBody. The collider defines the physical shape used for collision detection.
Collider Types
| Collider | Shape | Use Case |
|---|---|---|
| BoxCollider | Axis-aligned rectangle | Crates, platforms, walls |
| CircleCollider | Circle | Balls, coins, rounded objects |
| CapsuleCollider | Capsule (rectangle with rounded ends) | Characters, pills |
| SegmentCollider | Line segment | Thin walls, one-way platforms |
| PolygonCollider | Convex polygon (up to 8 vertices) | Custom convex shapes |
| ChainCollider | Chain of line segments | Terrain, complex static boundaries |
Common Properties
All colliders (except ChainCollider) share these properties:
| Property | Type | Default | Description |
|---|---|---|---|
density | number | 1.0 | Mass density. Affects total body mass |
friction | number | 0.6 | Surface friction (0 = ice, 1 = rubber) |
restitution | number | 0.0 | Bounciness (0 = no bounce, 1 = full bounce) |
isSensor | boolean | false | Trigger zone — detects overlap without physical response |
categoryBits | number | 1 | Collision filter category bits |
enabled | boolean | true | Enable/disable the collider |
BoxCollider
An axis-aligned rectangular collider.
| Property | Type | Default | Description |
|---|---|---|---|
halfExtents | Vec2 | {x: 0.5, y: 0.5} | Half-width and half-height in physics units |
offset | Vec2 | {x: 0, y: 0} | Offset from entity center in physics units |
radius | number | 0.0 | Corner rounding radius. Creates a rounded rectangle when > 0 |
Plus all common properties.
CircleCollider
A circular collider.
| Property | Type | Default | Description |
|---|---|---|---|
radius | number | 0.5 | Circle radius in physics units |
offset | Vec2 | {x: 0, y: 0} | Offset from entity center in physics units |
Plus all common properties.
CapsuleCollider
A capsule shape (rectangle with semicircle caps on top and bottom).
| Property | Type | Default | Description |
|---|---|---|---|
radius | number | 0.5 | Capsule radius in physics units |
halfHeight | number | 0.5 | Half-height of the rectangular center section in physics units |
offset | Vec2 | {x: 0, y: 0} | Offset from entity center in physics units |
Plus all common properties.
Collision Filtering
Collision layers let you control which objects can collide with each other. The system uses 16 named layers with bitmask filtering.
How It Works
Each collider has a categoryBits field that assigns it to a layer. The collision matrix in Settings → Physics → Collision Matrix determines which layers interact.
| Property | Type | Default | Description |
|---|---|---|---|
categoryBits | number | 1 | Layer this collider belongs to (bitmask, one bit per layer) |
Collision occurs when both colliders’ layers are allowed to interact in the collision matrix.
Editor Setup
- Name your layers in Settings → Physics → Collision Layers (up to 16 layers, e.g., “Player”, “Enemy”, “Ground”, “Projectile”)
- Configure the matrix in Settings → Physics → Collision Matrix — check which layer pairs should collide
- Assign layers in the Inspector — each collider’s
categoryBitsdropdown shows the named layers
See Also
- Segment Collider — line segment collider
- Polygon Collider — custom convex polygon collider
- Chain Collider — chain of line segments for terrain
- Events — collision and sensor events