vectorMagnitude: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<dt class="note">'''\[\[.*\]\]'''" to "<dt class="note">$1")
m (Fix username deletion mistake)
Line 11: Line 11:
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''vectorMagnitude''' vector |SYNTAX=
| [[vectorMagnitude]] vector |SYNTAX=


|p1= vector: [[Array]] |PARAMETER1=
|p1= vector: [[Array]] |PARAMETER1=
Line 18: Line 18:
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_size = [[vectorMagnitude]] [0,3,4]; //5</code> |EXAMPLE1=
|x1= <code>_size = [[vectorMagnitude]] [0,3,4]; {{cc|returns 5}}</code> |EXAMPLE1=


|x2= <code>_speed = [[vectorMagnitude]] [[velocity]] [[player]]; // return velocity of player in m/s
|x2= <code>_speed = [[vectorMagnitude]] [[velocity]] [[player]]; {{cc|return velocity of player in m/s}}
_speed = ([[vectorMagnitude]] [[velocity]] [[player]]) * 3.6; // return velocity of player in Km/h
_speed = ([[vectorMagnitude]] [[velocity]] [[player]]) * 3.6; {{cc|return velocity of player in km/h}}
_speed = ([[vectorMagnitude]] [[velocity]] [[player]]) * 2.23694; // return velocity of player in mph</code> |EXAMPLE2=
_speed = ([[vectorMagnitude]] [[velocity]] [[player]]) * 2.23694; {{cc|return velocity of player in mph}}</code> |EXAMPLE2=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[vectorAdd]], [[vectorDiff]], [[vectorCrossProduct]], [[vectorDotProduct]], [[vectorCos]], [[vectorMagnitudeSqr]], [[vectorMultiply]], [[vectorDistance]], [[vectorDistanceSqr]], [[vectorDir]], [[vectorUp]], [[setVectorDir]], [[setVectorUp]], [[setVectorDirAndUp]], [[vectorNormalized]], [[vectorFromTo]], [[matrixMultiply]], [[matrixTranspose]]  |SEEALSO=
| [[vectorAdd]], [[vectorDiff]], [[vectorCrossProduct]], [[vectorDotProduct]], [[vectorCos]], [[vectorMagnitudeSqr]], [[vectorMultiply]], [[vectorDistance]], [[vectorDistanceSqr]], [[vectorDir]], [[vectorUp]], [[setVectorDir]], [[setVectorUp]], [[setVectorDirAndUp]], [[vectorNormalized]], [[vectorFromTo]], [[matrixMultiply]], [[matrixTranspose]]  |SEEALSO=
}}
}}


Line 33: Line 32:
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on 28 Jun, 2014
<dd class="notedate">Posted on 28 Jun, 2014
<dt class="note">[[]]<dd class="note">
<dt class="note">[[User:ffur2007slx2_5| ffur2007slx2_5]]
(ArmA3 1.22)Algorithm:
<dd class="note">
<code>
(ArmA3 1.22) Algorithm:
Vector = [x,y,z];  
<code>Vector = [x,y,z];  
Result = [[sqrt]] ((x ^ 2) + (y ^ 2) + (z ^ 2))
Result = [[sqrt]] ((x ^ 2) + (y ^ 2) + (z ^ 2));
</code>
</code>
It is recommended to use [[vectorMagnitude]] instead of [[BIS_fnc_magnitude]].
It is recommended to use [[vectorMagnitude]] instead of [[BIS_fnc_magnitude]].
Line 44: Line 43:


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Revision as of 18:55, 19 May 2020

Hover & click on the images for description

Description

Description:
Magnitude of a 3D vector.
Groups:
Uncategorised

Syntax

Syntax:
vectorMagnitude vector
Parameters:
vector: Array
Return Value:
Number

Examples

Example 1:
_size = vectorMagnitude [0,3,4]; // returns 5
Example 2:
_speed = vectorMagnitude velocity player; // return velocity of player in m/s _speed = (vectorMagnitude velocity player) * 3.6; // return velocity of player in km/h _speed = (vectorMagnitude velocity player) * 2.23694; // return velocity of player in mph

Additional Information

See also:
vectorAddvectorDiffvectorCrossProductvectorDotProductvectorCosvectorMagnitudeSqrvectorMultiplyvectorDistancevectorDistanceSqrvectorDirvectorUpsetVectorDirsetVectorUpsetVectorDirAndUpvectorNormalizedvectorFromTomatrixMultiplymatrixTranspose

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

Posted on 28 Jun, 2014
ffur2007slx2_5
(ArmA3 1.22) Algorithm: Vector = [x,y,z]; Result = sqrt ((x ^ 2) + (y ^ 2) + (z ^ 2)); It is recommended to use vectorMagnitude instead of BIS_fnc_magnitude.

Bottom Section