> For the complete documentation index, see [llms.txt](https://cjcrafter.gitbook.io/mechanics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cjcrafter.gitbook.io/mechanics/mechanics/camera-shake.md).

# Camera Shake

{% hint style="success" %}
Have you purchased [WeaponMechanicsCosmetics](https://pluginify.org/resources/13/)? It is required for this Mechanic to work!
{% endhint %}

The camera shake mechanic smoothly oscillates the targeted player's pitch and yaw with a sinusoidal motion that decays over time. This is great for explosions, recoil, earthquake effects, or any "impact" feedback that you want the player to *feel*.

Unlike [Flinch](/mechanics/mechanics/flinch.md) (which is a single hard jolt), `CameraShake{}` is a sustained rolling shake that gradually settles.

| Argument      | Description                                                                                           | Default Value |
| ------------- | ----------------------------------------------------------------------------------------------------- | ------------- |
| `magnitude`   | The starting strength of the shake (in degrees of rotation). Larger values mean a more violent shake. | 1.2           |
| `decay`       | How much `magnitude` is subtracted per tick. Higher values stop the shake sooner.                     | 0.04          |
| `pitchPeriod` | How many ticks one full up/down oscillation takes. Lower values make the vertical wobble faster.      | 3.7           |
| `yawPeriod`   | How many ticks one full left/right oscillation takes. Lower values make the horizontal wobble faster. | 3.0           |
| `maxDuration` | A hard upper bound, in ticks, on how long the shake can last (independent of `decay`).                | 200           |

{% hint style="info" %}
The shake automatically stops once `magnitude` decays to zero, so you usually don't need to tune `maxDuration` unless you're using very low `decay` values.
{% endhint %}

{% hint style="warning" %}
The targeter must be a **player**. Other entities will be ignored. For per-explosion shakes, use `@Target{}` so each nearby player feels the shake from the impact's perspective.
{% endhint %}

{% tabs %}
{% tab title="Example 1" %}

```yaml
Mechanics:
  - "CameraShake{}"
```

A medium shake on the source player. Magnitude starts at 1.2 degrees and decays 0.04 degrees per tick, so the shake fully settles after about 30 ticks (1.5 seconds).
{% endtab %}

{% tab title="Example 2" %}

```yaml
Mechanics:
  - "CameraShake{magnitude=0.4, decay=0.05}"
```

A subtle recoil shake that is quick to start and quick to settle. Good for small caliber weapons.
{% endtab %}

{% tab title="Example 3" %}

```yaml
Mechanics:
  - "CameraShake{magnitude=4.0, decay=0.03, pitchPeriod=2.5, yawPeriod=2.0} @Target{}"
```

A violent, fast-oscillating shake applied to the targeted player. Great for explosion impacts or being hit by a heavy weapon.
{% endtab %}

{% tab title="Example 4" %}
This example comes from the WeaponMechanicsCosmetics `Sky_Torch` orbital laser:

```yaml
Mechanics:
  - "CameraShake{delayBeforePlay=45} @Target{}"
```

Fires one tick after the orbital beam impacts the target, giving nearby players the "earthquake" feeling that pairs with the visual explosion and sonic boom.
{% endtab %}
{% endtabs %}
