> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/newgen/rotation_manager.md).

# Rotation Manager

The `rotationManager` namespace sends a rotation (yaw/pitch) to the server without turning your camera.

***

### Rotating

Call [`rotationManager.rotate(yaw, pitch, speed)`](/newgen/api/functions/rotationmanager.rotate.md) from a `PreTickEvent` listener. It turns towards the target by at most `speed` degrees this tick, and returns `true` once the target is reached.

```js
script.addListener("PreTickEvent", () => {
    const done = rotationManager.rotate(90.0, 15.0, 6.0);

    if (done) {
        // we're now looking exactly at the target
    }
});
```

{% hint style="info" %}
Rotations are taken from `PreTickEvent` until the player ticks. Outside that window `rotate` does nothing and returns `false`; check `rotationManager.canRotate()` if you're unsure.
{% endhint %}

### Aiming at something

[`math.yawTo`](/newgen/api/functions/math.yawto.md) and [`math.pitchTo`](/newgen/api/functions/math.pitchto.md) give the rotation that faces from one point to another.

```js
script.addListener("PreTickEvent", () => {
    const player = mc.player;
    const target = mc.crosshairPickEntity;
    if (!player || !target) return;

    const eyes = player.getEyePosition(1);
    const aim = target.boundingBox.getCenter();
    rotationManager.rotate(math.yawTo(eyes, aim), math.pitchTo(eyes, aim), 30);
});
```

### Flags

Pass flags as the fourth argument, combined with `|`.

| Flag             | Effect                                                                          |
| ---------------- | ------------------------------------------------------------------------------- |
| `MOVE_FIX`       | Movement follows the sent yaw instead of the camera                             |
| `KEEP_DIRECTION` | With `MOVE_FIX`, keys are remapped so you still walk where the camera faces     |
| `INSTANT`        | Snap to the target, ignoring speed                                              |
| `EXACT`          | Send the rotation exactly as given, for rotations you already smoothed yourself |

```js
rotationManager.rotate(yaw, pitch, 0, rotationManager.MOVE_FIX | rotationManager.INSTANT);
```

### Priority

Each `rotate` call replaces earlier ones in the same tick, so the last caller wins. Among `PreTickEvent` listeners, including Breeze's own modules that rotate there, a lower priority runs later and therefore wins.

```js
script.addListener("PreTickEvent", () => {
    rotationManager.rotate(yaw, pitch, 10);
}, -10);
```

### Reading the Current Spoofed Angles

```js
const yaw   = rotationManager.getSpoofedYaw();
const pitch = rotationManager.getSpoofedPitch();
const far   = rotationManager.distance(yaw, pitch); // degrees from what the server has
```
