vectorMultiply: 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:
____________________________________________________________________________________________
____________________________________________________________________________________________


| vector '''vectorMultiply''' scalar |SYNTAX=
| vector [[vectorMultiply]] scalar |SYNTAX=


|p1= vector: [[Array]] |PARAMETER1=
|p1= vector: [[Array]] |PARAMETER1=
Line 20: Line 20:
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_newVector = [1,2,3] [[vectorMultiply]] 3; //[3,6,9]</code> |EXAMPLE1=
|x1= <code>_newVector = [1,2,3] [[vectorMultiply]] 3; {{cc|returns [3,6,9]}}</code> |EXAMPLE1=
____________________________________________________________________________________________
____________________________________________________________________________________________


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


Line 31: Line 30:
<!-- 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]; scalar = a;
<code>Vector = [x,y,z]; scalar = a;
Result = [(x * a),(y * a),(z * a)];
Result = [(x * a),(y * a),(z * a)];</code>
</code>
It is recommended to use [[vectorMultiply]] instead of [[BIS_fnc_vectorMultiply]]. This is a very useful function, as it can be used with the velocity command to move an object from one position to another. (ie <vector1> to <vector2>) - ensure both positions are found using [[getPosASL]].
It is recommended to use [[vectorMultiply]] instead of [[BIS_fnc_vectorMultiply]]. This is a very useful function, as it can be used with the velocity command to move an object from one position to another. (ie <vector1> to <vector2>) - ensure both positions are found using [[getPosASL]].
<code>
<code>_obj [[setVelocity]] ((([[getPosASL]] _target) [[vectorDiff]] ([[getPosASL]] _obj)) [[vectorMultiply]] 2);</code>
_obj [[setVelocity]] ((([[getPosASL]] _target) [[vectorDiff]] ([[getPosASL]] _obj)) [[vectorMultiply]] 2);
</code>
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>


<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 19:58, 19 May 2020

Hover & click on the images for description

Description

Description:
Multiplies 3D vector by a scalar.
Groups:
Uncategorised

Syntax

Syntax:
vector vectorMultiply scalar
Parameters:
vector: Array
scalar: Number
Return Value:
Array

Examples

Example 1:
_newVector = [1,2,3] vectorMultiply 3; // returns [3,6,9]

Additional Information

See also:
vectorAddvectorDiffvectorCrossProductvectorDotProductvectorCosvectorMagnitudevectorMagnitudeSqrvectorDistancevectorDistanceSqrvectorDirvectorUpsetVectorDirsetVectorUpsetVectorDirAndUpvectorNormalizedvectorFromTomatrixMultiplymatrixTranspose

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]; scalar = a; Result = [(x * a),(y * a),(z * a)]; It is recommended to use vectorMultiply instead of BIS_fnc_vectorMultiply. This is a very useful function, as it can be used with the velocity command to move an object from one position to another. (ie <vector1> to <vector2>) - ensure both positions are found using getPosASL. _obj setVelocity (((getPosASL _target) vectorDiff (getPosASL _obj)) vectorMultiply 2);

Bottom Section