getCameraViewDirection: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| arma3 |Game name=
| arma3
|1.58|Game Version (number surrounded by NO SPACES)=
|1.58
|arg= global|Multiplayer Arguments=
|arg= global


|gr1= Object Manipulation |GROUP1=
|gr1= Object Manipulation


| Returns the direction unit is looking in render time scope. While for AI the origin for the view direction vector can be taken from <tt>[[eyePos]] unit</tt>, for human player the origin should be taken from player camera position <tt>[[positionCameraToWorld]] [0,0,0]</tt> |DESCRIPTION=
| Returns the direction unit is looking in render time scope. While for AI the origin for the view direction vector can be taken from <tt>[[eyePos]] unit</tt>, for human player the origin should be taken from player camera position <tt>[[positionCameraToWorld]] [0,0,0]</tt>


| '''getCameraViewDirection''' unit |SYNTAX=
| '''getCameraViewDirection''' unit


|p1= unit: [[Object]] |PARAMETER1=
|p1= unit: [[Object]]


| [[Array]] - 3D Vector |RETURNVALUE=
| [[Array]] - 3D Vector


|x1= Draw AI eye direction (green), weapon direction (red) and camera direction (blue) in 3D: <code>bob = [[createGroup]] [[east]] [[createUnit]] ["O_Soldier_F", [0,0,0], [], 0, "NONE"];
|x1= Draw AI eye direction (green), weapon direction (red) and camera direction (blue) in 3D: <code>bob = [[createGroup]] [[east]] [[createUnit]] ["O_Soldier_F", [0,0,0], [], 0, "NONE"];
Line 26: Line 26:
_endV = (_beg [[vectorAdd]] ([[getCameraViewDirection]] bob [[vectorMultiply]] 100));
_endV = (_beg [[vectorAdd]] ([[getCameraViewDirection]] bob [[vectorMultiply]] 100));
[[drawLine3D]] [_beg, _endV, [0,0,1,1]];
[[drawLine3D]] [_beg, _endV, [0,0,1,1]];
};</code>|EXAMPLE1=
};</code>




| [[positionCameraToWorld]], [[weaponDirection]], [[eyeDirection]], [[vectorDir]], [[vectorDirVisual]] |SEEALSO=
| [[positionCameraToWorld]], [[weaponDirection]], [[eyeDirection]], [[vectorDir]], [[vectorDirVisual]]


|  |MPBEHAVIOUR=  
|  |MPBEHAVIOUR=  

Revision as of 00:34, 18 January 2021

Hover & click on the images for description

Description

Description:
Returns the direction unit is looking in render time scope. While for AI the origin for the view direction vector can be taken from eyePos unit, for human player the origin should be taken from player camera position positionCameraToWorld [0,0,0]
Groups:
Object Manipulation

Syntax

Syntax:
getCameraViewDirection unit
Parameters:
unit: Object
Return Value:
Array - 3D Vector

Examples

Example 1:
Draw AI eye direction (green), weapon direction (red) and camera direction (blue) in 3D: 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]]; _endV = (_beg vectorAdd (getCameraViewDirection bob vectorMultiply 100)); drawLine3D [_beg, _endV, [0,0,1,1]]; };

Additional Information

See also:
positionCameraToWorldweaponDirectioneyeDirectionvectorDirvectorDirVisual

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

Notes

Bottom Section