positionCameraToWorld: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "{{Command " to "{{RV|type=command ") |
Lou Montana (talk | contribs) m (Text replacement - "<dd class="notedate">Posted on ([^<>]+) " to "<dd class="notedate">Posted on $1</dd> ") |
||
Line 32: | Line 32: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on October 17, 2008 - 11:25 | <dd class="notedate">Posted on October 17, 2008 - 11:25</dd> | ||
<dt class="note">[[User:Kronzky|Kronzky]] | <dt class="note">[[User:Kronzky|Kronzky]] | ||
<dd class="note"> | <dd class="note"> | ||
By measuring the distance between the camera and the player one can determine whether 1st-person or 3rd-person view is being used: | By measuring the distance between the camera and the player one can determine whether 1st-person or 3rd-person view is being used: | ||
<code>[[if]] (([[positionCameraToWorld]] [0,0,0] [[distance]] [[player]])>2) [[then]] {[[hint]] "3rd person"} [[else]] {[[hint]] "1st person"};</code> | <code>[[if]] (([[positionCameraToWorld]] [0,0,0] [[distance]] [[player]])>2) [[then]] {[[hint]] "3rd person"} [[else]] {[[hint]] "1st person"};</code> | ||
<dd class="notedate">Posted on 22:45, 17 October 2010 (CEST) | <dd class="notedate">Posted on 22:45, 17 October 2010 (CEST)</dd> | ||
<dt class="note">[[User:Worldeater|Worldeater]]<dd class="note"> | <dt class="note">[[User:Worldeater|Worldeater]]<dd class="note"> | ||
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: | 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: |
Revision as of 01:01, 30 January 2021
Description
- Description:
- Description needed
- Groups:
- Camera ControlPositions
Syntax
- Syntax:
- Syntax needed
- Parameters:
- cameraPos: PositionRelative - Relative camera position, format [x, z, y]
- Return Value:
- Return value needed
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]]
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on October 17, 2008 - 11:25
- Kronzky
-
By measuring the distance between the camera and the player one can determine whether 1st-person or 3rd-person view is being used:
if ((positionCameraToWorld [0,0,0] distance player)>2) then {hint "3rd person"} else {hint "1st person"};
- Posted on 22:45, 17 October 2010 (CEST)
- 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];
- Posted on July 20, 2014 - 20:07 (UTC)
- AgentRev
- When over land, the position returned is in format PositionATL, and over sea, PositionASLW.