setVectorDirAndUp: Difference between revisions
Jump to navigation
Jump to search
m (Text replace - "{{uc:{{PAGENAME}}}}" to "{{uc:{{PAGENAME}}}} {{uc:{{PAGENAME}}}}") |
Killzone Kid (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | Sets orientation of an object. The command takes 2 vector arrays, one for [[vectorDir]] and one for [[vectorUp]]. Default object orientation will always have [[vectorDir]] pointing forward (North) along Y axis and [[vectorUp]] pointing up along Z axis - [[0,1,0],[0,0,1]], as shown on the diagram below. | ||
When attaching object to an object the axes are relative to the object that gets the attachment. If it is player object for example, then X goes from left to right, Y goes from back to front, and Z goes from down up. | |||
The [[setDir]] command is incompatible with [[setVectorDirAndUp]] and should not be used together on the same object. Using [[setVectorDirAndUp]] alone should be sufficient for any orientation.|= Description | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| vehicle '''setVectorDirAndUp''' [[x, z | | vehicle '''setVectorDirAndUp''' [[x, y, z],[x, y, z]] |= Syntax | ||
|p1= vehicle: [[Object]] |= Parameter 1 | |p1= vehicle: [[Object]] |= Parameter 1 | ||
|p2= [[x, z | |p2= [[x, y, z],[x, y, z]]: [[Array]] |= Parameter 2 | ||
| [[Nothing]] | |||
[[Image:Vectordirandup.jpg|300px]]|= Return value | |||
____________________________________________________________________________________________ | |||
|x1= To rotate BRICK on Z axis 90 degrees clockwise, change its [[vectorDir]] but leave [[vectorUp]] unchanged. | |||
<code>BRICK [[setVectorDirAndUp]] [[1,0,0],[0,0,1]];</code>|= Example 1 | |||
|x2= To rotate BRICK on Y axis 90 degrees clockwise, change its [[vectorUp]] but leave [[vectorDir]] unchanged. | |||
<code>BRICK [[setVectorDirAndUp]] [[0,1,0],[1,0,0]];</code>|= Example 2 | |||
|x3= To rotate BRICK on X axis 90 degrees (tilt forward), change both [[vectorDir]] and [[vectorUp]] accordingly. | |||
<code>BRICK [[setVectorDirAndUp]] [[0,0,-1],[0,1,0]];</code>|= Example 3 | |||
|x4= More complex orientations | |||
<code>//tilt forward 90 + rotate left 90 | |||
BRICK [[setVectorDirAndUp]] [[1,0,0],[0,1,0]]; | |||
//tilt backward 45 degrees | |||
BRICK [[setVectorDirAndUp]] [[0,0.5,0.5],[0,-0.5,0.5]]; | |||
//tilt forward 30 degrees | |||
BRICK [[setVectorDirAndUp]] [[0,0.66,-0.33],[0,0.33,0.66]]; | |||
</code>|= Example 4 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Revision as of 10:27, 3 August 2013
Description
- Description:
- Sets orientation of an object. The command takes 2 vector arrays, one for vectorDir and one for vectorUp. Default object orientation will always have vectorDir pointing forward (North) along Y axis and vectorUp pointing up along Z axis - [[0,1,0],[0,0,1]], as shown on the diagram below. When attaching object to an object the axes are relative to the object that gets the attachment. If it is player object for example, then X goes from left to right, Y goes from back to front, and Z goes from down up. The setDir command is incompatible with setVectorDirAndUp and should not be used together on the same object. Using setVectorDirAndUp alone should be sufficient for any orientation.
- Groups:
- Uncategorised
Syntax
- Syntax:
- vehicle setVectorDirAndUp [[x, y, z],[x, y, z]]
- Parameters:
- vehicle: Object
- [[x, y, z],[x, y, z]]: Array
- Return Value:
- Nothing
Examples
- Example 1:
- To rotate BRICK on Z axis 90 degrees clockwise, change its vectorDir but leave vectorUp unchanged.
BRICK setVectorDirAndUp [[1,0,0],[0,0,1]];
- Example 2:
- To rotate BRICK on Y axis 90 degrees clockwise, change its vectorUp but leave vectorDir unchanged.
BRICK setVectorDirAndUp [[0,1,0],[1,0,0]];
- Example 3:
- To rotate BRICK on X axis 90 degrees (tilt forward), change both vectorDir and vectorUp accordingly.
BRICK setVectorDirAndUp [[0,0,-1],[0,1,0]];
- Example 4:
- More complex orientations
//tilt forward 90 + rotate left 90 BRICK setVectorDirAndUp [[1,0,0],[0,1,0]]; //tilt backward 45 degrees BRICK setVectorDirAndUp [[0,0.5,0.5],[0,-0.5,0.5]]; //tilt forward 30 degrees BRICK setVectorDirAndUp [[0,0.66,-0.33],[0,0.33,0.66]];
Additional Information
- See also:
- vectorUpsetVectorUpvectorDirsetVectorDir
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
Notes
- Posted on March 16, 2008 - 09:50
- Str
- Command can be also used to rotate camera in all three axis (which also mean it's possible to set camera bank).
- Posted on May 9, 2008 - 09:32
- General Barron
- The object's vectorDir can only control its pitch, while its vectorUp can only control its bank. To set an object's yaw (direction), use the setdir command, before using this command. You would think vectorUp would control pitch as well, but any pitch that would be set due to vectorUp is ignored. The same is true with vectorDir and yaw; any vectorDir that would adjust yaw is also ignored. If this doesn't make sense, try to visualize it with a box or soda can. This command does NOT work with values relative to a unit, but rather it works with world vectors (think world coordinates as opposed to model coordinates). As a result, this command can be difficult to use in many situations, because the input values needed to get a certain pitch / bank for an object vary, depending on what direction the object is facing (yaw). A function to set an object's pitch / bank can be found here
- Posted on October 23rd, 2009 - 18:39
- Chris330
- Note this odd command may now be better understood. There's a thread about it here: BI Studios Forum Thread
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma version 1.09
- Arma: New Scripting Commands
- Arma: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands: Global Effect
- Scripting Commands OFP Elite
- Scripting Commands ArmA
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters