---
name: "eyeDirection"
type: command
status: ok
groups: ["Object Manipulation"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/eyeDirection
revid: 377870
updated: 2026-01-04T11:39:04Z
---

# eyeDirection

*Command · Object Manipulation · Arma 3 v0.50*

Locality: arguments **global**

## Description

Returns the direction object is watching (eyes, or a vehicle's primary observer).

## Syntax

```sqf
eyeDirection unit
```

**Parameters:**

- `unit`: [Object](../topics/Object.md)

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

## Examples

### Example 1

Keep a can in front of the player's *face*:

```sqf
Can = "Land_Can_V3_F" createVehicle getPosATL player;
onEachFrame {
    _eyePos = eyePos player;
    _eyeDir = eyeDirection player;
    Can setPosASL [
        _eyePos select 0 + (_eyeDir select 0),
        _eyePos select 1 + (_eyeDir select 1),
        _eyePos select 2 + (_eyeDir select 2)
    ]
};
```

### 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) · [weaponDirection](../commands/weaponDirection.md) · [getCameraViewDirection](../commands/getCameraViewDirection.md) · [vectorDir](../commands/vectorDir.md) · [vectorDirVisual](../commands/vectorDirVisual.md)

## Community notes

**Killzone_Kid** — 2014-05-26

This command should have really been named *headDirection* instead of [eyeDirection](../commands/eyeDirection.md) as one could mistakenly think that eyes direction of your avatar correspond to the direction of the centre of your screen.
Play with the script in [#Example 1](../commands/eyeDirection.md#example-1) to find out limitations. If you need centre of screen direction, use [positionCameraToWorld](../commands/positionCameraToWorld.md) instead.

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