screenToWorldDirection: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{RV|type=command |game1= arma3 |version1= 2.18 |gr1= Positions |descr= Returns the 3D vector in world corresponding to the given point on the screen (in UI coordinates), as if the vector was aiming from the camera to the screen position. |s1= screenToWorldVector screen |p1= screen: Array - screen position [x,y] (see SafeZone for more info) |r1= Array - Vector3D world vector |s2= camera screenToWorldVector position |p21= camera: [[Object]...")
 
m (Add devbranch)
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
|game1= arma3
|game1= arma3
|version1= 2.18
|version1= 2.18
|branch= dev


|gr1= Positions
|gr1= Positions
Line 8: Line 10:
|descr= Returns the 3D vector in world corresponding to the given point on the screen (in UI coordinates), as if the vector was aiming from the camera to the screen position.  
|descr= Returns the 3D vector in world corresponding to the given point on the screen (in UI coordinates), as if the vector was aiming from the camera to the screen position.  


|s1= [[screenToWorldVector]] screen
|s1= [[screenToWorldDirection]] screen


|p1= screen: [[Array]] - screen position [x,y] (see [[SafeZone]] for more info)
|p1= screen: [[Array]] - screen position [x,y] (see [[SafeZone]] for more info)
Line 14: Line 16:
|r1= [[Array]] - [[Vector3D]] world vector
|r1= [[Array]] - [[Vector3D]] world vector


|s2= camera [[screenToWorldVector]] position
|s2= camera [[screenToWorldDirection]] position


|p21= camera: [[Object]] - camera object
|p21= camera: [[Object]] - camera object
Line 22: Line 24:
|r2= [[Array]] - [[Vector3D]] world vector
|r2= [[Array]] - [[Vector3D]] world vector


|x1= <sqf>_vec = screenToWorldVector [0.5, 0.5]; // a vector pointing to the front of the camera</sqf>
|x1= <sqf>private _vec = screenToWorldDirection [0.5, 0.5]; // a vector pointing to the front of the camera</sqf>


|seealso= [[SafeZone]] [[worldToScreen]] [[screenToWorld]]
|seealso= [[SafeZone]] [[worldToScreen]] [[screenToWorld]]
}}
}}

Latest revision as of 20:06, 6 August 2024

Hover & click on the images for description
Only available in Development branch(es) until its release with Arma 3 patch v2.18.

Description

Description:
Returns the 3D vector in world corresponding to the given point on the screen (in UI coordinates), as if the vector was aiming from the camera to the screen position.
Groups:
Positions

Syntax

Syntax:
screenToWorldDirection screen
Parameters:
screen: Array - screen position [x,y] (see SafeZone for more info)
Return Value:
Array - Vector3D world vector

Alternative Syntax

Syntax:
camera screenToWorldDirection position
Parameters:
camera: Object - camera object
position: Array - screen position [x,y] (see SafeZone for more info)
Return Value:
Array - Vector3D world vector

Examples

Example 1:
private _vec = screenToWorldDirection [0.5, 0.5]; // a vector pointing to the front of the camera

Additional Information

See also:
SafeZone worldToScreen screenToWorld

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