vectorDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(see also)
m (Text replacement - "killzone_kid" to "Killzone_Kid")
 
(77 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= ofpe
|version1= 1.00


|1.00|= Game version
|game2= arma1
|version2= 1.00


|arg= global |=  
|game3= arma2
____________________________________________________________________________________________
|version3= 1.00


| Return object's normalized direction vector in world space (<tt>[x,y,z]</tt>).
|game4= arma2oa
* A unit facing North would return <tt>[0,1,0]</tt>
|version4= 1.50
* A unit facing East would return <tt>[1,0,0]</tt>
* A unit facing South would return <tt>[0,-1,0]</tt>
* A unit facing West would return <tt>[-1,0,0]</tt> |= Description
____________________________________________________________________________________________


| '''vectorDir''' objectName |= Syntax
|game5= tkoh
|version5= 1.00


|p1= objectName: [[Object]] |= Parameter 1
|game6= arma3
|version6= 0.50


| [[Array]] - format [[Vector3D]] |= Return value
|arg= global
____________________________________________________________________________________________


|x1= <code>_dirVector = [[vectorDir]] _unit;</code> |= Example 1
|gr2= Math - Vectors
____________________________________________________________________________________________


| [[vectorDirVisual]], [[vectorUp]], [[setVectorDir]], [[setVectorUp]], [[setVectorDirAndUp]], [[vectorDiff]], [[vectorAdd]], [[vectorMultiply]], [[vectorCrossProduct]], [[vectorDistance]], [[vectorMagnitudeSqr]], [[vectorDistanceSqr]], [[vectorCos]], [[vectorMagnitude]], [[vectorDotProduct]], [[vectorNormalized]], [[vectorFromTo]]|= See also
|descr= [[File:arma3_object-vectors.jpg|thumb|right|An object with its [[vectorDir]], [[vectorUp]] and [[vectorSide]] (vectors not to scale)]]
Returns an object's direction vector in world space.


{{Feature|important|The vector is '''not necessarily [[vectorNormalized|normalized]]'''. The [[vectorMagnitude|magnitude]] of the vector depends on the [[getObjectScale|object's scale]].}}
For an object facing one of the cardinal directions on perfectly flat ground (parallel to the XY-plane of the world space), [[vectorDir]] returns simple values:
* {{hl|[0, 1, 0]}} if the object is facing directly north
* {{hl|[1, 0, 0]}} if the object is facing directly east
* {{hl|[0, -1, 0]}} if the object is facing directly south
* {{hl|[-1, 0, 0]}} if the object is facing directly west
|s1= [[vectorDir]] object
|p1= object: [[Object]]
|r1= [[Array]] format [[Vector3D]]
|x1= <sqf>_vecDir = vectorDir MyObject;</sqf>
|seealso= [[vectorModelToWorld]] [[vectorDirVisual]] [[vectorSide]] [[vectorSideVisual]] [[vectorUp]] [[setVectorDir]] [[setVectorUp]] [[setVectorDirAndUp]] [[vectorDiff]] [[vectorAdd]] [[vectorMultiply]] [[vectorCrossProduct]] [[vectorDistance]] [[vectorMagnitudeSqr]] [[vectorDistanceSqr]] [[vectorCos]] [[vectorMagnitude]] [[vectorDotProduct]] [[vectorNormalized]] [[vectorFromTo]] [[BIS_fnc_transformVectorDirAndUp]]
}}
}}


<h3 style="display:none">Notes</h3>
 
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
<dt></dt>
<dd class="notedate">Posted on 2019-02-02 - 01:03 (UTC)</dd>
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dd class="note"> vectorDir 2D:
<sqf>[sin _azimuth, cos _azimuth, 0]</sqf>
vectorDir 3D:
<sqf>[sin _azimuth * cos _altitude, cos _azimuth * cos _altitude, sin _altitude]</sqf>
</dd>


[[Category:Scripting Commands|VECTORDIR]]
</dl>
[[Category:Scripting Commands OFP Elite |VECTORDIR]]
[[Category:Scripting Commands ArmA|VECTORDIR]]
[[Category:Scripting Commands ArmA2|VECTORDIR]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Latest revision as of 18:52, 18 February 2024

Hover & click on the images for description

Description

Description:
An object with its vectorDir, vectorUp and vectorSide (vectors not to scale)

Returns an object's direction vector in world space.

The vector is not necessarily normalized. The magnitude of the vector depends on the object's scale.

For an object facing one of the cardinal directions on perfectly flat ground (parallel to the XY-plane of the world space), vectorDir returns simple values:

  • [0, 1, 0] if the object is facing directly north
  • [1, 0, 0] if the object is facing directly east
  • [0, -1, 0] if the object is facing directly south
  • [-1, 0, 0] if the object is facing directly west
Groups:
Math - Vectors

Syntax

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

Examples

Example 1:
_vecDir = vectorDir MyObject;

Additional Information

See also:
vectorModelToWorld vectorDirVisual vectorSide vectorSideVisual vectorUp setVectorDir setVectorUp setVectorDirAndUp vectorDiff vectorAdd vectorMultiply vectorCrossProduct vectorDistance vectorMagnitudeSqr vectorDistanceSqr vectorCos vectorMagnitude vectorDotProduct vectorNormalized vectorFromTo BIS_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 2019-02-02 - 01:03 (UTC)
Killzone_Kid
vectorDir 2D:
[sin _azimuth, cos _azimuth, 0]
vectorDir 3D:
[sin _azimuth * cos _altitude, cos _azimuth * cos _altitude, sin _altitude]