{"name":"positionCameraToWorld","title":"positionCameraToWorld","type":"command","url":"https://community.bistudio.com/wiki/positionCameraToWorld","revid":378531,"updated":"2026-05-04T02:19:23Z","groups":["Camera Control","Positions"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","description":"Get the world coordinate space (AGL) from a camera-relative position.","syntaxes":[{"syntax":"positionCameraToWorld cameraPos","params":[{"name":"cameraPos","type":"PositionRelative","description":"relative camera position, format **[x, z, y]** (X = left-right, Z = below-above, Y = back-front)\n\n> [!IMPORTANT]\n> This command has Y and Z axes swapped around, which is different from the usual model space coordinates format ([x, y, z]).","type_expr":"PositionRelative"}],"returns":{"type":"PositionAGL","type_expr":"PositionAGL","description":"camera world position"},"form":"unary","right":{"text":"cameraPos"}}],"examples":[{"code":["_worldPos = positionCameraToWorld _cameraPos;"]},{"text":"Example demonstrating reversed Y and Z:\n\n```sqf\nplayer setDir 0; // assuming player is looking forward\nhint str [positionCameraToWorld [0,0,0], positionCameraToWorld [0,0,1]];\n/*\n[\n    [2481.35, 5671.21, 1.51395],\n    [2481.35, 5672.21, 1.46955]\n]\n*/\n```","code":["player setDir 0; // assuming player is looking forward\nhint str [positionCameraToWorld [0,0,0], positionCameraToWorld [0,0,1]];\n/*\n[\n\t[2481.35, 5671.21, 1.51395],\n\t[2481.35, 5672.21, 1.46955]\n]\n*/"]},{"code":["_cameraAGLPosition = positionCameraToWorld [0,0,0];"]}],"see_also":["modelToWorld","modelToWorldVisual","getCameraViewDirection","weaponDirection","eyeDirection","vectorDir","vectorDirVisual"],"notes":[{"user":"Kronzky","date":"2008-10-17T11:25:00Z","text":"By measuring the distance between the camera and the player one can determine whether 1st-person or 3rd-person view is being used:\n\n```sqf\nif ((positionCameraToWorld [0,0,0] distance player)>2) then { hint \"3rd person\" } else { hint \"1st person\" };\n```"},{"user":"Worldeater","date":"2010-10-17T22:45:00Z","text":"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:\n\n```sqf\npositionCameraToWorld [5,10,15] == _camera modelToWorld [5,15,10];\n```"}]}