CapsuleCollider2D
Optional feature
CapsuleCollider2D is part of 2D Physics. A build includes it only when a scene, prefab or script uses it — see Feature cropping.
From a script
ts
import { CapsuleCollider2DComponent } from "mmpx";
const capsuleCollider2D = this.entity.TryGetComponent(CapsuleCollider2DComponent);Full API: CapsuleCollider2DComponent.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
Is TriggerisTrigger | boolean | false | Reports overlaps (OnTriggerEnter2D …) instead of colliding |
Layerlayer | physics layer | 0 | Physics layer — Project Settings → Physics decides which layers collide |
Offset XoffsetX | number | 0 | |
Offset YoffsetY | number | 0 | |
Widthwidth | number (0 … ∞) | 50 | |
Heightheight | number (0 … ∞) | 100 | |
Directiondirection | "vertical" | "horizontal" | "vertical" | Which way the rounded ends point |
Material
| Field | Type | Default | Description |
|---|---|---|---|
Densitydensity | number (0 … ∞) | 1 | Mass per square metre — used when the Rigidbody2D has Use Auto Mass on |
Frictionfriction | number (0 … ∞) | 0.4 | 0 = ice; the two colliders' frictions combine (√(a·b)) |
Bouncinessbounciness | number (0 … 1) | 0 | Restitution: 0 = no bounce, 1 = keeps all its speed (the higher of the two wins) |