> For the complete documentation index, see [llms.txt](https://devmosaic.gitbook.io/devmosaic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devmosaic.gitbook.io/devmosaic/resources/devmosaic-dm-movement/controls-and-features.md).

# Controls And Features

In-depth guide to using traversal, leaning, corner peeking, and ballistics in-game.

`dm-movement` enhances gunplay and parkour movement by bridging the gap between realistic tactical mechanics and smooth FiveM gameplay.

***

### Ledge Traversal & Smart Vaulting

Unlike default GTA V climbing which often feels rigid or fails on custom maps and props, `dm-movement` performs dynamic multi-point surface raycasts to detect viable ledges and landing zones in real time.

#### How It Works

1. **Vaulting (Low Obstacles)**:
   * **Trigger**: Approach a low fence, barrier, or waist-high wall (< 1.05m) and press your jump key.
   * **Behavior**: The script verifies that the obstacle is thin enough (`maxDepth`) and that the ground on the other side is safe (`maxDrop`). Your character cleanly vaults over and lands running on the other side.
2. **Mantling (Medium Obstacles)**:
   * **Trigger**: Jump towards obstacles between 1.05m and 1.75m.
   * **Behavior**: Your character places their hands on top and hoists their body up onto the surface.
3. **High Climbing (Tall Ledges)**:
   * **Trigger**: Jump towards tall walls, container boxes, or roof edges up to 2.55m high.
   * **Behavior**: The character grabs the lip of the ledge overhead with their hands and pulls their body up to stand on top.
4. **Mid-Air Fall Catch**:
   * **Trigger**: Fall or jump from an elevated point past a ledge or railing with a downward velocity exceeding 2.0 m/s.
   * **Behavior**: If a valid ledge is within arm's reach while falling, the character catches the edge mid-air and pulls themselves up, preventing fall damage.

{% hint style="info" %}
During traversal animations, weapon firing and unwanted movement controls are temporarily blocked to prevent desynchronization or animation glitches.
{% endhint %}

***

### Tactical Leaning & Corner Peeking

Leaning allows players in tactical gunfights to check angles and peek around cover without exposing their entire character model.

#### Controls

* **Lean Left**: `+dmLeanLeft` (Default: **Mouse 5** / `MOUSE_EXTRABTN2`)
* **Lean Right**: `+dmLeanRight` (Default: **Mouse 4** / `MOUSE_EXTRABTN1`)
* **Gamepad / Controller**: Optional button configuration (Default: **LB** for left, **RB** for right when enabled).

{% hint style="info" %}
Players can customize their keybindings at any time via GTA Pause Menu (**ESC**) > **Settings** > **Key Bindings** > **FiveM**.
{% endhint %}

#### Obstruction Detection

When leaning next to a wall or concrete pillar, `dm-movement` performs side raycasts from the player's torso bone (`SKEL_Spine3`). If a solid surface is within the lean path:

* The lean angle is clamped to prevent the player model from clipping through walls.
* Prevents players from exploiting geometry to peek through solid textures.

#### Dynamic Camera

While leaning, the camera smoothly pans outward in the direction of the lean, shifts slightly forward, and focuses slightly closer to simulate tilting your head around cover.

***

### Muzzle Obstruction (Ballistics)

In standard GTA V, bullets originate from the camera center line rather than the physical weapon barrel, allowing players to exploit "head-glitching" or shoot through objects if their camera can see over them.

#### How Muzzle Obstruction Fixes This

1. **Muzzle Bone Detection**: The script tracks the exact world coordinates of the weapon's `gun_muzzle` bone.
2. **Raycast Verification**: It casts a ray from the weapon barrel towards the player's crosshair target.
3. **Obstruction Check**: If a wall, pillar, or prop is within `coverRange` (default 2.0m) and directly blocks the path of the barrel:
   * Weapon firing controls are temporarily disabled (`DisablePlayerFiring`).
   * An intuitive **red "X" indicator** is drawn in the 3D world at the point of contact.
4. **Resuming Fire**: As soon as the player steps back, clears the cover, or angles their weapon away from the obstacle, the indicator clears and weapon fire is instantly restored.
