# Scripting

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

Scripts move bodies through the Rigid Body 2D component and ask the world what is where through `aego/physics`.

```aes
body := node.Get<Body2D>()
v := body.Velocity
body.SetVelocity(Vec2{x * Speed, v.Y})
body.ApplyImpulse(JumpImpulse)
```

## Moving a body

- Forces and torque act during the next physics step. Call `ApplyForce` and `ApplyTorque` from `FixedUpdate`.
- Impulses change the velocity at once, scaled by mass. They suit jumps and hits.
- `MoveTo` drives a kinematic body to a pose by the end of the next step. `Teleport` moves a body without sweeping and keeps its velocity.

Every method is listed on the [Rigid Body 2D](/ref/physics.Body2D.md) page.

## Queries

Raycasts, line casts and overlap tests ignore the caller's own body and skip triggers. They work only during Play. Functions that fill an `out` slice write at most `len(out)` entries, so size the slice once with `append` and reuse it.

Every function is listed on the [aego/physics](/ref/aego/physics.md) page.
