---
name: "weaponDirection"
type: command
status: ok
groups: ["Weapons", "Unit Control"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/weaponDirection
revid: 377763
updated: 2026-01-03T00:59:33Z
---

# weaponDirection

*Command · Weapons, Unit Control · Arma 3 v0.50 · introduced in Operation Flashpoint: Elite v1.00*

Locality: arguments **global**

## Description

Returns the direction that the vehicle weapon is aiming in. For addons the weapon name must be an entry in CfgWeapons.

> [!NOTE]
> Turret and gun angle in degrees can also be obtained using [animationSourcePhase](../commands/animationSourcePhase.md) or [animationPhase](../commands/animationPhase.md) commands.

## Syntax

```sqf
vehicleName weaponDirection weaponName
```

**Parameters:**

- `vehicleName`: [Object](../topics/Object.md)
- `weaponName`: [String](../topics/String.md)

**Returns:** [Vector3D](../topics/Vector3D.md)

## Examples

### Example 1

```sqf
_weaponVectorDir = player weaponDirection currentWeapon player;
```

### Example 2

Draw AI eye direction (green) and weapon direction (red) in 3D:

```sqf
bob = createGroup east createUnit ["O_Soldier_F", [0,0,0], [], 0, "NONE"];
bob setVehiclePosition [player modelToWorld [0,100,0], [], 0, "NONE"];
onEachFrame
{
    _beg = ASLToAGL eyePos bob;
    _endE = _beg vectorAdd (eyeDirection bob vectorMultiply 100);
    drawLine3D [_beg, _endE, [0,1,0,1]];
    _endW = _beg vectorAdd (bob weaponDirection currentWeapon bob vectorMultiply 100);
    drawLine3D [_beg, _endW, [1,0,0,1]];
};
```

## See also

[positionCameraToWorld](../commands/positionCameraToWorld.md) · [getCameraViewDirection](../commands/getCameraViewDirection.md) · [eyeDirection](../commands/eyeDirection.md) · [vectorDir](../commands/vectorDir.md) · [vectorDirVisual](../commands/vectorDirVisual.md)

<sub>Source: [BI Community Wiki — weaponDirection](https://community.bistudio.com/wiki/weaponDirection) (revision 377763).</sub>
