vectorDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \{\{GameCategory\|[a-z]+[0-9]?\|Scripting Commands\}\}" to "")
No edit summary
Line 23: Line 23:
|gr2= Math - Vectors
|gr2= Math - Vectors


|descr= Returns object's normalized direction vector in world space (<tt>[x,y,z]</tt>).  
|descr= Returns object direction vector in world space (<tt>[x,y,z]</tt>).
{{Feature|important|The vector is '''not necessarily normalized'''. The '''magnitude''' of the vector will be the same as the [[getObjectScale|object scale]].}}
* A unit facing North would return <tt>[0,1,0]</tt>
* A unit facing North would return <tt>[0,1,0]</tt>
* A unit facing East would return <tt>[1,0,0]</tt>
* A unit facing East would return <tt>[1,0,0]</tt>

Revision as of 16:36, 29 July 2021

Hover & click on the images for description

Description

Description:
Returns object direction vector in world space ([x,y,z]).
The vector is not necessarily normalized. The magnitude of the vector will be the same as the object scale.
  • A unit facing North would return [0,1,0]
  • A unit facing East would return [1,0,0]
  • A unit facing South would return [0,-1,0]
  • A unit facing West would return [-1,0,0]
Groups:
Math - Vectors

Syntax

Syntax:
vectorDir object
Parameters:
object: Object
Return Value:
Array - format Vector3D

Examples

Example 1:
_dirVector = vectorDir _unit;

Additional Information

See also:
vectorModelToWorldvectorDirVisualvectorUpsetVectorDirsetVectorUpsetVectorDirAndUpvectorDiffvectorAddvectorMultiplyvectorCrossProductvectorDistancevectorMagnitudeSqrvectorDistanceSqrvectorCosvectorMagnitudevectorDotProductvectorNormalizedvectorFromToBIS_fnc_transformVectorDirAndUp

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 February 2, 2019 - 01:03 (UTC)
killzone_kid
vectorDir 2D: [sin _azimuth, cos _azimuth, 0] vectorDir 3D: [sin _azimuth * cos _altitude, cos _azimuth * cos _altitude, sin _altitude]