setVectorDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \{\{GameCategory\|[a-z]+[0-9]?\|Scripting Commands\}\}" to "")
m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ")
Line 26: Line 26:
|descr= Set object's direction vector. Up vector will remain unchanged.
|descr= Set object's direction vector. Up vector will remain unchanged.


|s1= object '''setVectorDir''' [x,y,z]
|s1= object '''setVectorDir''' [x,y,z]


|p1= object: [[Object]]
|p1= object: [[Object]]


|p2= [x,y,z]: [[Array]]
|p2= [x,y,z]: [[Array]]

Revision as of 22:27, 19 June 2021

Hover & click on the images for description

Description

Description:
Set object's direction vector. Up vector will remain unchanged.
Groups:
Math - Vectors

Syntax

Syntax:
object setVectorDir [x,y,z]
Parameters:
object: Object
[x,y,z]: Array
Return Value:
Nothing

Examples

Example 1:
player setVectorDir [5,6,1];

Additional Information

See also:
vectorDirvectorUpsetVectorUpsetVectorDirAndUpvectorDiffvectorAddvectorMultiplyvectorCrossProductvectorDistancevectorMagnitudeSqrvectorDistanceSqrvectorCosvectorMagnitudevectorDotProductvectorNormalizedvectorFromTo

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 March 16, 2008 - 09:50
Str
Command can be also used to rotate camera in all three axis.
Posted on 21:06, 3 March 2009 (CET)
General Barron
setVectorDir can only influence an object's pitch. It can not influence bank. Example: player setVectorDir [0,0,1]
  • If the player is facing 0 degrees (north), then this will do NOTHING.
  • If the player is facing 90 degrees (east), then this will make him pitch 90 degrees up.
You can't directly pitch an object beyond 90 degrees, because this would change its facing direction. You must first flip it is direction using setDir, then you must bank the object 180 degrees, THEN you pitch the object appropriately.


Posted on August 17, 2015 - 03:27 (UTC)
DreadedEntity
In Arma 3, setVectorDir does not control an object's pitch or bank, in fact, it is not possible to change either of those solely using setVectorDir. This command can only affect horizontal rotation along the x-plane, unless an object first has it is vectorUp changed to something other than [0,0,1]. Correct input to setVectorDir should be calculated using the trigonometric functions sin and cos. examples: 0 degrees (north) player setVectorDir [ sin 0, //equals 0 cos 0, //equals 1 1 ]; 45 degrees (north-east) player setVectorDir [ sin 45, //equals 0.707 cos 45, //equals 0.707 1 ]; If you are doing trigonometric calculations, it may be better to use setVectorDir rather than setDir, since sine and cosine have already been calculated and will not need to be re-calculated (also, setDir probably uses setVectorDir anyway.)