setVectorUp: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| arma1 \|1.00 \|([^g]|g[^a])" to "| ofpe | 1.00 |game2= arma1 |version2= 1.00 |game3= arma2 |version3= 1.00 |game4= arma2oa |version4= 1.50 |game5= tkoh |version5= 1.00 |game6= arma3 |version6= 0.50 |$1") |
Lou Montana (talk | contribs) m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>") |
||
(40 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| ofpe | |game1= ofpe | ||
| 1.00 | |version1= 1.00 | ||
|game2= arma1 | |game2= arma1 | ||
Line 24: | Line 24: | ||
|gr2= Math - Vectors | |gr2= Math - Vectors | ||
| Set object's up vector. Direction of the object remain unchanged. Default object's [[vectorUp]] is [0,0,1]. | |descr= Set object's up vector. Direction of the object remain unchanged. Default object's [[vectorUp]] is [0,0,1]. | ||
|s1= object [[setVectorUp]] vectorUp | |||
|p1= object: [[Object]] | |p1= object: [[Object]] | ||
|p2= [ | |p2= vectorUp: [[Array]] format [[Vector3D|Vector]] (normalised) | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= Turn object upside down: | |x1= Turn object upside down: | ||
< | <sqf>_obj setVectorUp [0,0,-1];</sqf> | ||
|x2= Align object with the terrain underneath: | |x2= Align object with the terrain underneath: | ||
< | <sqf>_obj setVectorUp surfaceNormal getPosASL _obj;</sqf> | ||
|seealso= [[vectorDir]] | |seealso= [[vectorDir]] [[vectorUp]] [[setVectorDir]] [[setVectorDirAndUp]] [[vectorDiff]] [[vectorAdd]] [[vectorMultiply]] [[vectorCrossProduct]] [[vectorDistance]] [[vectorMagnitudeSqr]] [[vectorDistanceSqr]] [[vectorCos]] [[vectorMagnitude]] [[vectorDotProduct]] [[vectorNormalized]] [[vectorFromTo]] | ||
}} | }} | ||
< | {{Note | ||
|user= General Barron | |||
|timestamp= 20090303210700 | |||
|text= [[setVectorUp]] can only influence an object's bank. It can not influence pitch. Example: | |||
<sqf>player setVectorUp [0,1,0]</sqf> | |||
If the player is facing 0 degrees (north), then this will do NOTHING.<br> | |||
If the player is facing 90 degrees (east), then this will make him bank 90 degrees to his left. | |||
}} | |||
{{Note | |||
|user= Kronzky | |||
|timestamp= 20070322050700 | |||
|text= An in-depth discussion on the concept of vectors is available {{Link|link= http://forums.bistudio.com/showthread.php?t=50914|text= here}}. | |||
}} | |||
{{Note | |||
|user= Str | |||
|timestamp= 20080316094900 | |||
|text= Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank). | |||
}} | |||
{{Note | |||
|user= Killzone_Kid | |||
|timestamp= 20131003090400 | |||
|text= It is possible to change both pitch and bank of an object ([[surfaceNormal]] application for instance). Assuming an ammo box in the following example is facing North (default direction is 0): | |||
<sqf> | |||
_ammobox setVectorUp [0,1,0]; // box is pitched 90 degrees forward | |||
_ammobox setVectorUp [1,0,0]; // box is banked 90 degrees to the right | |||
</sqf> | |||
It is possible to change both pitch and bank of an object ([[surfaceNormal]] application for instance). Assuming an ammo box in the following example is facing North (default direction is 0):< | |||
_ammobox | |||
However the above will stop working as soon as you attach the box to something. The following trick however will work in this case: | However the above will stop working as soon as you attach the box to something. The following trick however will work in this case: | ||
< | <sqf> | ||
_ammobox | _ammobox attachTo [player, [0,2,1]]; | ||
_ammobox | _ammobox setVectorUp [0,0.99,0.01]; // box is pitched ~90 degrees forward | ||
</ | _ammobox setVectorUp [0.99,0,0.01]; // box is banked ~90 degrees to the right | ||
</sqf> | |||
}} | |||
Latest revision as of 19:43, 3 September 2024
Description
- Description:
- Set object's up vector. Direction of the object remain unchanged. Default object's vectorUp is [0,0,1].
- Groups:
- Math - Vectors
Syntax
- Syntax:
- object setVectorUp vectorUp
- Parameters:
- object: Object
- vectorUp: Array format Vector (normalised)
- Return Value:
- Nothing
Examples
- Example 1:
- Turn object upside down:
_obj setVectorUp [0,0,-1];
- Example 2:
- Align object with the terrain underneath:
Additional Information
- See also:
- vectorDir vectorUp setVectorDir setVectorDirAndUp vectorDiff vectorAdd vectorMultiply vectorCrossProduct vectorDistance vectorMagnitudeSqr vectorDistanceSqr vectorCos vectorMagnitude vectorDotProduct vectorNormalized vectorFromTo
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 03, 2009 - 21:07 (UTC)
-
setVectorUp can only influence an object's bank. It can not influence pitch. Example:
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 bank 90 degrees to his left.
- Posted on Mar 22, 2007 - 05:07 (UTC)
- An in-depth discussion on the concept of vectors is available here.
- Posted on Mar 16, 2008 - 09:49 (UTC)
- Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank).
- Posted on Oct 03, 2013 - 09:04 (UTC)
-
It is possible to change both pitch and bank of an object (surfaceNormal application for instance). Assuming an ammo box in the following example is facing North (default direction is 0):
However the above will stop working as soon as you attach the box to something. The following trick however will work in this case:_ammobox setVectorUp [0,1,0]; // box is pitched 90 degrees forward _ammobox setVectorUp [1,0,0]; // box is banked 90 degrees to the right
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