Str
Command can be also used to rotate camera in all three axis.
Results appear below as you type; use the arrow keys to move through them.
Command · Markdown · JSON · original wiki page
Set object's direction vector. Up vector will remain unchanged.
object setVectorDir vectorDir
Parameters:
Returns: Nothing
player setVectorDir [5,6,1];
// provided _myMine is local
_myMine setVectorDir [0.3, 1, 0];
_myMine setPosWorld getPosWorld _myMine; // synchronises the mine's direction over the network (special case)
The effect is Local effect when using setVectorDir on a mine. Use a position modification to broadcast setVectorDir's change (see Example 2).
vectorDir · vectorUp · setVectorUp · setVectorDirAndUp · vectorDiff · vectorAdd · vectorMultiply · vectorCrossProduct · vectorDistance · vectorMagnitudeSqr · vectorDistanceSqr · vectorCos · vectorMagnitude · vectorDotProduct · vectorNormalized · vectorFromTo
Command can be also used to rotate camera in all three axis.
setVectorDir can only influence an object's pitch. It can not influence bank. Example:
player setVectorDir [0,0,1];
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.
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.)