setVectorDir: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "</dl> <dl class="command_description"> " to "") |
Lou Montana (talk | contribs) (This problem is Mine) |
||
Line 25: | Line 25: | ||
|descr= Set object's direction vector. Up vector will remain unchanged. | |descr= Set object's direction vector. Up vector will remain unchanged. | ||
|pr= The effect is {{Icon|localeffect|32}} when using [[setVectorDir]] on a mine. Use a position modification to broadcast [[setVectorDir]]'s change (see {{HashLink|#Example 2}}). | |||
|s1= object [[setVectorDir]] [x,y,z] | |s1= object [[setVectorDir]] [x,y,z] | ||
Line 30: | Line 32: | ||
|p1= object: [[Object]] | |p1= object: [[Object]] | ||
|p2= [x,y,z]: [[Array]] | |p2= [x,y,z]: [[Array]] format [[Vector3D]] | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= <code>[[player]] [[setVectorDir]] [5,6,1];</code> | |x1= <code>[[player]] [[setVectorDir]] [5,6,1];</code> | ||
|x2= <code>{{cc|provided _myMine is local}} | |||
_myMine [[setVectorDir]] [0.3, 1, 0]; | |||
_myMine [[setPosWorld]] [[getPosWorld]] _myMine;</code> | |||
|seealso= [[vectorDir]], [[vectorUp]], [[setVectorUp]], [[setVectorDirAndUp]], [[vectorDiff]], [[vectorAdd]], [[vectorMultiply]], [[vectorCrossProduct]], [[vectorDistance]], [[vectorMagnitudeSqr]], [[vectorDistanceSqr]], [[vectorCos]], [[vectorMagnitude]], [[vectorDotProduct]], [[vectorNormalized]], [[vectorFromTo]] | |seealso= [[vectorDir]], [[vectorUp]], [[setVectorUp]], [[setVectorDirAndUp]], [[vectorDiff]], [[vectorAdd]], [[vectorMultiply]], [[vectorCrossProduct]], [[vectorDistance]], [[vectorMagnitudeSqr]], [[vectorDistanceSqr]], [[vectorCos]], [[vectorMagnitude]], [[vectorDotProduct]], [[vectorNormalized]], [[vectorFromTo]] | ||
}} | }} | ||
{{Note | |||
|user= Str | |||
|timestamp= 20080316095000 | |||
|text= Command can be also used to rotate camera in all three axis. | |||
}} | |||
{{Note | |||
|user= General Barron | |||
|timestamp= 20090303210600 | |||
|text= [[setVectorDir]] can only influence an object's pitch. It can not influence bank. Example: | |||
<code>player setVectorDir [0,0,1]</code> | <code>player setVectorDir [0,0,1]</code> | ||
*If the player is facing 0 degrees (north), then this will do NOTHING. | *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. | *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. | 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. | ||
}} | |||
{{Note | |||
|user= DreadedEntity | |||
|timestamp= 20150817032700 | |||
|text= 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]]. | |||
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: | examples: | ||
<code>0 degrees (north) | <code>{{cc|0 degrees (north)}} | ||
[[player]] [[setVectorDir]] | [[player]] [[setVectorDir]] | ||
[ | [ | ||
[[sin]] 0, | [[sin]] 0, {{cc|equals 0}} | ||
[[cos]] 0, | [[cos]] 0, {{cc|equals 1}} | ||
1 | 1 | ||
]; | ]; | ||
45 degrees (north-east) | {{cc|45 degrees (north-east)}} | ||
[[player]] [[setVectorDir]] | [[player]] [[setVectorDir]] | ||
[ | [ | ||
[[sin]] 45, | [[sin]] 45, {{cc|equals 0.707}} | ||
[[cos]] 45, | [[cos]] 45, {{cc|equals 0.707}} | ||
1 | 1 | ||
];</code> | ];</code> | ||
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 | 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.) | (also, [[setDir]] probably uses [[setVectorDir]] anyway.) | ||
}} | |||
Revision as of 13:24, 18 November 2021
Description
- Description:
- Set object's direction vector. Up vector will remain unchanged.
- Problems:
- The effect is LELocal when using setVectorDir on a mine. Use a position modification to broadcast setVectorDir's change (see Example 2).
- Groups:
- Math - Vectors
Syntax
- Syntax:
- object setVectorDir [x,y,z]
- Parameters:
- object: Object
- [x,y,z]: Array format Vector3D
- Return Value:
- Nothing
Examples
- Example 1:
player setVectorDir [5,6,1];
- Example 2:
// provided _myMine is local _myMine setVectorDir [0.3, 1, 0]; _myMine setPosWorld getPosWorld _myMine;
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 Mar 16, 2008 - 09:50 (UTC)
- Command can be also used to rotate camera in all three axis.
- Posted on Mar 03, 2009 - 21:06 (UTC)
-
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.
- Posted on Aug 17, 2015 - 03:27 (UTC)
-
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.)
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Elite version 1.00
- Operation Flashpoint: Elite: New Scripting Commands
- Operation Flashpoint: Elite: Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Math - Vectors
- Scripting Commands: Global Effect