setVectorUp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|gr1= Vectors|GROUP1=" to "|gr2= Math - Vectors |GROUP2=")
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(66 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma |Game name=
|game1= ofpe
|version1= 1.00


|1.00|Game version=
|game2= arma1
|version2= 1.00


|arg=local |ARG=  
|game3= arma2
|eff=global |EFFECT=
|version3= 1.00


|gr2= Math - Vectors |GROUP2=
|game4= arma2oa
____________________________________________________________________________________________
|version4= 1.50


| Set object's up vector. Direction of the object remain unchanged. Default object's [[vectorUp]] is [0,0,1].
|game5= tkoh
|version5= 1.00


In Multiplayer, [[setVectorUp]] must be executed on the machine where the object it applied to is [[local]]. |DESCRIPTION=
|game6= arma3
____________________________________________________________________________________________
|version6= 0.50


| object '''setVectorUp''' [x, y, z] |SYNTAX=
|arg=local
|eff=global


|p1= object: [[Object]] |PARAMETER1=
|gr2= Math - Vectors


|p2= [x, y, z]: [[Array]] |PARAMETER2=
|descr= Set object's up vector. Direction of the object remain unchanged. Default object's [[vectorUp]] is [0,0,1].


| [[Nothing]] |RETURNVALUE=
|s1= object [[setVectorUp]] vectorUp
____________________________________________________________________________________________
 
|p1= object: [[Object]]
 
|p2= vectorUp: [[Array]] format [[Vector3D|Vector]] (normalised)
 
|r1= [[Nothing]]


|x1= Turn object upside down:
|x1= Turn object upside down:
<code>_obj [[setVectorUp]] [0,0,-1];</code>|EXAMPLE1=
<sqf>_obj setVectorUp [0,0,-1];</sqf>
 
|x2= Align object with the terrain underneath:
|x2= Align object with the terrain underneath:
<code>_obj [[setVectorUp]] [[surfaceNormal]] [[position]] _obj;</code>|EXAMPLE2=
<sqf>_obj setVectorUp surfaceNormal getPosASL _obj;</sqf>


|[[vectorDir]], [[vectorUp]], [[setVectorDir]], [[setVectorDirAndUp]], [[vectorDiff]], [[vectorAdd]], [[vectorMultiply]], [[vectorCrossProduct]], [[vectorDistance]], [[vectorMagnitudeSqr]], [[vectorDistanceSqr]], [[vectorCos]], [[vectorMagnitude]], [[vectorDotProduct]], [[vectorNormalized]], [[vectorFromTo]]|SEEALSO=
|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.
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= Kronzky
<!-- Note Section BEGIN -->
|timestamp= 20070322050700
<dd class="notedate">Posted 21:07, 3 March 2009 (CET)
|text= An in-depth discussion on the concept of vectors is available {{Link|link= http://forums.bistudio.com/showthread.php?t=50914|text= here}}.
<dt class="note">[[User:General Barron|General Barron]]<dd class="note">
}}
setVectorUp can only influence an object's bank. It can not influence pitch. Example:
    player setVectorUp [0,1,0]
    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.
</dd></dt></dd>


<dd class="notedate">Posted on March 22, 2007 - 05:07
{{Note
<dt class="note">[[User:Kronzky|Kronzky]]<dd class="note">
|user= Str
An in-depth discussion on the concept of vectors is available [http://forums.bistudio.com/showthread.php?t=50914 here].
|timestamp= 20080316094900
</dd></dt></dd>
|text= Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank).
}}


<dd class="notedate">Posted on March 16, 2008 - 09:49
{{Note
<dt class="note">[[User:Str|Str]]<dd class="note">Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank).
|user= Killzone_Kid
</dd></dt></dd>
|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):
<dd class="notedate">Posted on October 3, 2013
<sqf>
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]<dd class="note">
_ammobox setVectorUp [0,1,0]; // box is pitched 90 degrees forward
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):<code>_ammobox [[setVectorUp]] [0,1,0]; //box is pitched 90 degrees forward
_ammobox setVectorUp [1,0,0]; // box is banked 90 degrees to the right
_ammobox [[setVectorUp]] [1,0,0]; //box is banked 90 degrees to the right</code>
</sqf>
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:
<code>_ammobox [[attachTo]] [<nowiki/>[[player]], [0,2,1]];
<sqf>
_ammobox [[setVectorUp]] [0,0.99,0.01]; //box is pitched ~90 degrees forward
_ammobox attachTo [player, [0,2,1]];
_ammobox [[setVectorUp]] [0.99,0,0.01]; //box is banked ~90 degrees to the right</code>
_ammobox setVectorUp [0,0.99,0.01]; // box is pitched ~90 degrees forward
</dd></dt></dd>
_ammobox setVectorUp [0.99,0,0.01]; // box is banked ~90 degrees to the right
 
</sqf>
<!-- Note Section END -->
}}
</dl>
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SETVECTORUP]]
[[Category:Scripting Commands OFP Elite |SETVECTORUP]]
[[Category:Scripting Commands Armed Assault|SETVECTORUP]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]

Latest revision as of 19:43, 3 September 2024

Hover & click on the images for description

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:
_obj setVectorUp surfaceNormal getPosASL _obj;

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
General Barron - c
Posted on Mar 03, 2009 - 21:07 (UTC)
setVectorUp can only influence an object's bank. It can not influence pitch. Example:
player setVectorUp [0,1,0]
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.
Kronzky - c
Posted on Mar 22, 2007 - 05:07 (UTC)
An in-depth discussion on the concept of vectors is available here.
Str - c
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).
Killzone_Kid - c
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):
_ammobox setVectorUp [0,1,0]; // box is pitched 90 degrees forward _ammobox setVectorUp [1,0,0]; // box is banked 90 degrees to the right
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 attachTo [player, [0,2,1]]; _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