> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.lorenzo0111.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Attachments

> Add wheels, turrets and other moving model parts to your vehicles

# Attachments

Attachments were added in version 2.6. They are extra model parts that follow a vehicle, each on its own armor stand. They can move on their own: wheels roll and steer, and turrets turn and fire.

The default T50 tank uses a turret attachment for its cannon.

> [!NOTE]
>
> Vehicles that use the old `complexadditions` section are converted when they are loaded. The `t50tankcannon` addition becomes a turret. Other additions are skipped and a warning is shown in the console.

## The attachments section

Add attachments in the `attachments` section of a vehicle file. Each key is the name of one attachment:

```yaml theme={null}
attachments:
  front_left_wheel:
    type: Wheel
    material: RABBIT_HIDE
    id: 60
    position: {==: Vector, x: 1.3, y: 0.0, z: -0.8}
    radius: 0.4
    steerAngle: 30
```

These options work for every attachment type:

| Key | Description | Default |
| - | - | - |
| `type` | The attachment type: `Wheel`, `Turret` or a type added by another plugin | Required |
| `name` | The name of the model item | The section key |
| `material` | The material of the model item. Leave it out for an attachment with no model | None |
| `id` | The custom model data of the model item | `0` |
| `position` | Where the attachment is, relative to the vehicle model. +X is forward, +Y is up and +Z is to the side | `0, 0, 0` |
| `seat` | The seat that controls the attachment: `driver`, `none` or the index of a passenger seat in the `passagers` list | Depends on the type |

The keys pressed by the player in the controlling seat are sent to the attachment.

## Wheel

A wheel rolls with the speed of the vehicle. Front wheels can also steer when the driver turns.

| Key | Description | Default |
| - | - | - |
| `radius` | The radius of the wheel in blocks, used to roll it at the speed of the vehicle. Must be greater than 0 | `0.5` |
| `center` | The center of the wheel relative to the armor stand. Leave it out to use the center of the model item | Center of the item |
| `steerAngle` | How many degrees the wheel turns when the driver turns. `0` means the wheel does not steer | `0` |

A steering wheel is controlled by the driver seat unless you set another `seat`. The wheel goes back to the center when the driver stops turning.

## Turret

A turret turns left and right when the player in its seat presses <kbd>A</kbd> and <kbd>D</kbd>, and it can fire from the end of its barrel.

| Key | Description | Default |
| - | - | - |
| `pivot` | The point the turret turns around, relative to the armor stand. Use it when the model is not centered on the armor stand | `0, 0, 0` |
| `muzzle` | The end of the barrel relative to the pivot, when the turret faces forward. Shots start here | `1, 0, 0` |
| `turnSpeed` | How many radians the turret turns per tick | `0.05` |
| `maxYaw` | The max number of degrees the turret can turn from the front on each side. `0` means no limit | `0` |
| `cooldown` | The number of ticks between two shots | `20` |
| `fire` | Which input fires on each key. The keys are `LMB`, `RMB` and `F` | None |
| `seat` | The seat that controls the turret | `driver` |

The `fire` values are the same inputs used by the [`InputManager`](https://wiki.lorenzo0111.me/qualityarmoryvehicles/vehicles/creating-vehicle#inputmanager): `HONK`, `SIREN`, `MININUKE_BOMBER`, `TNT_BOMBER`, `40MM_LAUNCHER` and `BULLETS_556`. Use `none` to leave a key free.

### Example: the T50 cannon

This is the cannon of the default T50. The gunner sits in passenger seat `0`, and left-click fires a 40mm shell every 2 seconds:

```yaml theme={null}
attachments:
  cannon:
    type: Turret
    name: T50 Cannon
    material: RABBIT_HIDE
    id: 39
    position: {==: Vector, x: 0.0, y: 0.0, z: 0.0}
    pivot: {==: Vector, x: -1.08, y: 0.0, z: 0.0}
    muzzle: {==: Vector, x: 3.0, y: 3.0, z: 0.0}
    seat: 0
    turnSpeed: 0.05
    maxYaw: 0
    cooldown: 40
    fire:
      LMB: 40MM_LAUNCHER
```

> [!TIP]
>
> When QualityArmory is installed, the `40MM_LAUNCHER` uses the range, gravity, damage, explosion radius and knockback of QualityArmory's `m79` gun. The damage goes through QualityArmory, so armor and kill credit work like they do for its guns.

## Custom attachment types

Other plugins can add their own attachment types. See the [Developer API](https://wiki.lorenzo0111.me/qualityarmoryvehicles/developers/api.md#custom-attachments).

A vehicle file can use a custom type before the plugin that adds it has loaded. The attachment is created when the type is registered.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.