Arma 3 Scripting

Command in Camera Control, Positions

positionCameraToWorld

Also available as Markdown and JSON, or read the original wiki page.

Description

Get the world coordinate space (AGL) from a camera-relative position.

Syntax

positionCameraToWorld cameraPos

Parameters:

Returns: PositionAGL - camera world position

Examples

Example 1

_worldPos = positionCameraToWorld _cameraPos;

Example 2

Example demonstrating reversed Y and Z:

player setDir 0; // assuming player is looking forward
hint str [positionCameraToWorld [0,0,0], positionCameraToWorld [0,0,1]];
/*
[
    [2481.35, 5671.21, 1.51395],
    [2481.35, 5672.21, 1.46955]
]
*/

Example 3

_cameraAGLPosition = positionCameraToWorld [0,0,0];

See also

modelToWorld · modelToWorldVisual · getCameraViewDirection · weaponDirection · eyeDirection · vectorDir · vectorDirVisual

Community notes

Worldeater

The camera coordinate system is different from the model coordinate system: when modelToWorld uses [x, y, z] then positionCameraToWorld uses [x, z, y]. So for a steady camera the following is true:

positionCameraToWorld [5,10,15] == _camera modelToWorld [5,15,10];