# Capsule Collider 2D

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

```
component physics.CapsuleCollider2D
```

Capsule along the local X axis; Length is the full extent including the caps.

## From a script

Crouch by shortening the capsule.

```aes check
package player

import "aego/input"

script Crouch {
    var Standing float = 1
    var Crouching float = 0.4

    func Update(dt float) {
        capsule := node.Get<CapsuleCollider2D>()
        capsule.Length = Standing
        if input.Held("Crouch") {
            capsule.Length = Crouching
        }
    }
}
```

## Fields

| Name | Script name | Type | Default | Description |
|---|---|---|---|---|
| Offset | `Offset` | `Vec2` | `(0, 0)` | Position of the shape in node space. |
| Is Trigger | `IsTrigger` | `bool` | `false` | Detects overlaps and sends trigger events without pushing bodies apart. |
| Friction | `Friction` | `float` | `0.6` | Resistance to sliding along other shapes; 0 is ice. Two shapes use the square root of the product. |
| Restitution | `Restitution` | `float` | `0` | Bounciness: 0 stops on impact, 1 bounces back at the same speed. Two shapes use the larger value. |
| Density | `Density` | `float` | `1` | Mass per square unit; gives the body its mass when Mass Mode is auto. |
| Length | `Length` | `float` | `1` | Full length along the local X axis, caps included. |
| Radius | `Radius` | `float` | `0.25` | Radius of the caps and half the thickness. |
