setVectorDirAndUp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Undo revision 92250 by Waffle SS. (talk))
m (Some wiki formatting)
 
(105 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= arma1
|version1= 1.09


|1.09|= Game version
|game2= arma2
|version2= 1.00


|arg=local |=  
|game3= arma2oa
|eff=global |=
|version3= 1.50
____________________________________________________________________________________________


| 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.<br>
|game4= tkoh
|version4= 1.00


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. <br>
|game5= arma3
|version5= 0.50


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. <br>
|arg= local


In Multiplayer, [[setVectorDirAndUp]] must be executed on the machine where the object it applied to is [[local]]. |= Description
|eff= global
____________________________________________________________________________________________


| vehicle '''setVectorDirAndUp''' [[x1, y1, z1],[x2, y2, z2]] |= Syntax
|gr2= Math - Vectors


|p1= vehicle: [[Object]] |= Parameter 1
|descr= [[File:Vectordirandup.jpg|right|300px]] 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 (see also [[BIS_fnc_transformVectorDirAndUp]]).<br>


|p2= [[x1, y1, z1],[x2, y2, z2]]: [[Array]] |= Parameter 2
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.<br>
 
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.
 
|s1= vehicle [[setVectorDirAndUp]] [vectorDir, vectorUp]
 
|p1= vehicle: [[Object]]
 
|p2= vectorDir: [[Array]] format [[Vector3D]] - [[vectorDir]]
 
|p3= vectorUp: [[Array]] format [[Vector3D]] - [[vectorUp]]
 
|r1= [[Nothing]]
 
|x1= <sqf>
// set exact yaw, pitch, and roll
_yaw = 45; _pitch = -80; _roll = 0;
_myObject setVectorDirAndUp [
[sin _yaw * cos _pitch, cos _yaw * cos _pitch, sin _pitch],
[[sin _roll, -sin _pitch, cos _roll * cos _pitch], -_yaw] call BIS_fnc_rotateVector2D
];
</sqf>
 
|x2= To rotate _myObject on Z axis 90 degrees clockwise, change its [[vectorDir]] but leave [[vectorUp]] unchanged.
<sqf>_myObject setVectorDirAndUp [[1,0,0], [0,0,1]];</sqf>
 
|x3= To rotate _myObject on Y axis 90 degrees clockwise, change its [[vectorUp]] but leave [[vectorDir]] unchanged.
<sqf>_myObject setVectorDirAndUp [[0,1,0], [1,0,0]];</sqf>
 
|x4= To rotate _myObject on X axis 90 degrees (tilt forward), change both [[vectorDir]] and [[vectorUp]] accordingly.
<sqf>_myObject setVectorDirAndUp [[0,0,-1], [0,1,0]];</sqf>


|p3= [x1, y1, z1]: [[Array]] - [[vectorDir]] |= Parameter 3
|p4= [x2, y2, z2]: [[Array]] - [[vectorUp]] |= Parameter 4
| [[Nothing]]
<br><br>
[[Image:Vectordirandup.jpg|300px]]|= Return value
____________________________________________________________________________________________
|x1= <code>// set exact yaw, pitch, and roll
_y = 45; _p = -80; _r = 0;
BRICK [[setVectorDirAndUp]] [
[ [[sin]] _y * [[cos]] _p,[[cos]] _y * [[cos]] _p,[[sin]] _p],
[ [ [[sin]] _r,-[[sin]] _p,[[cos]] _r * [[cos]] _p],-_y] [[call]] [[BIS_fnc_rotateVector2D]]
];</code>|= Example 1
 
|x2= 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 2
|x3= 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 3
|x4= 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 4
|x5= More complex orientations
|x5= More complex orientations
<code>//tilt forward 90 + rotate left 90
<sqf>
BRICK [[setVectorDirAndUp]] [[1,0,0],[0,1,0]];
// tilt forward 90 + rotate left 90
//tilt backward 45 degrees
_myObject setVectorDirAndUp [[1,0,0], [0,1,0]];
BRICK [[setVectorDirAndUp]] [[0,0.5,0.5],[0,-0.5,0.5]];
// tilt backward 45 degrees
//tilt forward 30 degrees
_myObject setVectorDirAndUp [[0,0.5,0.5], [0,-0.5,0.5]];
BRICK [[setVectorDirAndUp]] [[0,0.66,-0.33],[0,0.33,0.66]];
// tilt forward 30 degrees
</code>|= Example 5
_myObject setVectorDirAndUp [[0,0.66,-0.33], [0,0.33,0.66]];
</sqf>


____________________________________________________________________________________________
|seealso= [[vectorDir]] [[vectorUp]] [[setVectorDir]] [[setVectorUp]] [[vectorDiff]] [[vectorAdd]] [[vectorMultiply]] [[vectorCrossProduct]] [[vectorDistance]] [[vectorMagnitudeSqr]] [[vectorDistanceSqr]] [[vectorCos]] [[vectorMagnitude]] [[vectorDotProduct]] [[vectorNormalized]] [[vectorFromTo]] [[BIS_fnc_transformVectorDirAndUp]]
|[[vectorDir]], [[vectorUp]], [[setVectorDir]], [[setVectorUp]], [[vectorDiff]], [[vectorAdd]], [[vectorMultiply]], [[vectorCrossProduct]], [[vectorDistance]], [[vectorMagnitudeSqr]], [[vectorDistanceSqr]], [[vectorCos]], [[vectorMagnitude]], [[vectorDotProduct]], [[vectorNormalized]], [[vectorFromTo]] |= See also 
}}


{{Note
|user= Str
|timestamp= 20080316095000
|text= Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank).
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= General Barron
<!-- Note Section BEGIN -->
|timestamp= 20080509093200
<dd class="notedate">Posted on March 16, 2008 - 09:50
|text= 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.
<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's possible to set camera bank).
 
<dd class="notedate">Posted on May 9, 2008 - 09:32
<dt class="note">'''[[User:General Barron|General Barron]]'''<dd class="note">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.
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).
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 [http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=e219d8da3fd34cabd2501a118a297257;act=ST;f=71;t=73312 here]
A function to set an object's pitch / bank can be found {{Link|link= http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=e219d8da3fd34cabd2501a118a297257;act=ST;f=71;t=73312|text= here}}
}}


<dd class="notedate">Posted on October 23rd, 2009 - 18:39
{{Note
<dt class="note">'''[[User:Chris330|Chris330]]'''<dd class="note">
|user= Chris330
Note this odd command may now be better understood. There's a thread about it here:
|timestamp= 20091023183900
[http://forums.bistudio.com/showthread.php?p=1470985#post1470985 BI Studios Forum Thread]
|text= Note this odd command may now be better understood. There's a thread about it here:
{{Link|link= http://forums.bistudio.com/showthread.php?p=1470985#post1470985|text= BI Studios Forum Thread}}
}}


<dd class="notedate">Posted on 1 Jun, 2014 - 1845
{{Note
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note">
|user= ffur2007slx2_5
(ArmA3 ver 1.20) [[setDir]] overwrites [[setVectorDirAndUp]] (P.S. [[setVectorDirAndUp]] also affects [[setVelocity]].), so use [[setDir]] before [[BIS_fnc_setPitchBank]], which is an easier workaround on vector, if changing yaw, pitch and bank are needed. [[setVectorDirAndUp]] is CCW, so if we wanna to set an obj 40 degrees CW, 170 degrees pitch and 85 degrees bank:
|timestamp= 20140601184500
<code>_obj [[setDir]] (40 - 180); [_obj, 170, 85] [[call]] [[BIS_fnc_setPitchBank]];</code>
|text= {{GVI|arma3|1.20}} [[setDir]] overwrites [[setVectorDirAndUp]] (P.S. [[setVectorDirAndUp]] also affects [[setVelocity]].), so use [[setDir]] before [[BIS_fnc_setPitchBank]], which is an easier workaround on vector, if changing yaw, pitch and bank are needed. [[setVectorDirAndUp]] is CCW, so if we wanna to set an obj 40 degrees CW, 170 degrees pitch and 85 degrees bank:
<sqf>_obj setDir (40 - 180); [_obj, 170, 85] call BIS_fnc_setPitchBank;</sqf>
Same as:
Same as:
<code>_obj [[setVectorDirAndUp]] [[0.63,0.75,0.17],[-0.75,0.65,-0.084]];</code>
<sqf>_obj setVectorDirAndUp [[0.63,0.75,0.17],[-0.75,0.65,-0.084]];</sqf>
Be aware that [[attachTo]] may flip [[vectorDir]] if pitch beyond 90 degrees and cause unexpected behavior to [[BIS_fnc_setPitchBank]], e.g.
Be aware that [[attachTo]] may flip [[vectorDir]] if pitch beyond 90 degrees and cause unexpected behavior to [[BIS_fnc_setPitchBank]], e.g.
<code>[_obj, 100, 0] call [[BIS_fnc_setPitchBank]]; //vector: [-0.14,-0.09,0.98],[-0.83,-0.51,-0.17]</code>
<sqf>[_obj, 100, 0] call BIS_fnc_setPitchBank; // vector: [-0.14,-0.09,0.98],[-0.83,-0.51,-0.17]</sqf>
<code>_obj [[attachTo]] [_logic,[0,0,2]];
<sqf>_obj attachTo [_logic,[0,0,2]];
[_obj, 100, 0] call [[BIS_fnc_setPitchBank]]; //vector: [0.11,0.33,0.93],[-0.06,0.94,-0.32]
[_obj, 100, 0] call BIS_fnc_setPitchBank; // vector: [0.11,0.33,0.93],[-0.06,0.94,-0.32]
compass direction algorism failed if obj was attached at present.</code>
</sqf>
To overcome such limitation we can use fallowing function for a better workaround. (code originated from [[bapedibupa]], remodified)
compass direction algorithm failed if obj was attached at present.
<code>
To overcome such limitation we can use fallowing function for a better workaround. (code originated from '''bapedibupa'', remodified)
_obj [[attachTo]] [_logic,[0,0,2]];
<sqf>_obj attachTo [_logic,[0,0,2]];
[_obj,[120,-78,37]] call fnc_SetPitchBankYaw; // pitch: 120, bank: -78, yaw: 37</code>
[_obj,[120,-78,37]] call fnc_SetPitchBankYaw; // pitch: 120, bank: -78, yaw: 37</sqf>
<code>
<sqf>fnc_SetPitchBankYaw = {
fnc_SetPitchBankYaw = {  
private ["_object", "_rotations", "_aroundX", "_aroundY", "_aroundZ", "_dirX", "_dirY",
    [[private]] ["_object","_rotations","_aroundX","_aroundY","_aroundZ","_dirX","_dirY",
"_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up", "_dirXTemp", "_upXTemp"];
"_dirZ","_upX","_upY","_upZ","_dir","_up","_dirXTemp","_upXTemp"];
_object = _this select 0;
    _object = _this [[select]] 0;  
_rotations = _this select 1;
    _rotations = _this [[select]] 1;  
_aroundX = _rotations select 0;
    _aroundX = _rotations [[select]] 0;  
_aroundY = _rotations select 1;
    _aroundY = _rotations [[select]] 1;  
_aroundZ = (360 - (_rotations select 2)) - 360;
    _aroundZ = (360 - (_rotations [[select]] 2)) - 360;  
_dirX = 0;
    _dirX = 0;  
_dirY = 1;
    _dirY = 1;  
_dirZ = 0;
    _dirZ = 0;  
_upX = 0;
    _upX = 0;  
_upY = 0;
    _upY = 0;  
_upZ = 1;
    _upZ = 1;  
if (_aroundX != 0) then {
    [[if]] (_aroundX != 0) [[then]] {  
_dirY = cos _aroundX;
        _dirY = [[cos]] _aroundX;  
_dirZ = sin _aroundX;
        _dirZ = [[sin]] _aroundX;  
_upY = -sin _aroundX;
        _upY = -[[sin]] _aroundX;  
_upZ = cos _aroundX;
        _upZ = [[cos]] _aroundX;  
};
    };  
if (_aroundY != 0) then {
    [[if]] (_aroundY != 0) [[then]] {  
_dirX = _dirZ * sin _aroundY;
        _dirX = _dirZ * [[sin]] _aroundY;  
_dirZ = _dirZ * cos _aroundY;
        _dirZ = _dirZ * [[cos]] _aroundY;  
_upX = _upZ * sin _aroundY;
        _upX = _upZ * [[sin]] _aroundY;  
_upZ = _upZ * cos _aroundY;
        _upZ = _upZ * [[cos]] _aroundY;  
};
    };  
if (_aroundZ != 0) then {
    [[if]] (_aroundZ != 0) [[then]] {  
_dirXTemp = _dirX;
        _dirXTemp = _dirX;  
_dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
        _dirX = (_dirXTemp* [[cos]] _aroundZ) - (_dirY * [[sin]] _aroundZ);  
_dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
        _dirY = (_dirY * [[cos]] _aroundZ) + (_dirXTemp * [[sin]] _aroundZ);      
_upXTemp = _upX;
        _upXTemp = _upX;  
_upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
        _upX = (_upXTemp * [[cos]] _aroundZ) - (_upY * [[sin]] _aroundZ);  
_upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
        _upY = (_upY * [[cos]] _aroundZ) + (_upXTemp * [[sin]] _aroundZ);
};
    };  
_dir = [_dirX,_dirY,_dirZ];
    _dir = [_dirX,_dirY,_dirZ];  
_up = [_upX,_upY,_upZ];
    _up = [_upX,_upY,_upZ];  
_object setVectorDirAndUp [_dir,_up];
    _object [[setVectorDirAndUp]] [_dir,_up];  
};</sqf>
};
}}
</code>
<!-- Note Section END -->
</dl>
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SETVECTORDIRANDUP]]
[[Category:Scripting Commands OFP Elite |SETVECTORDIRANDUP]]
[[Category:Scripting Commands ArmA|SETVECTORDIRANDUP]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Latest revision as of 16:31, 20 April 2023

Hover & click on the images for description

Description

Description:
Vectordirandup.jpg
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 (see also BIS_fnc_transformVectorDirAndUp).

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:
Math - Vectors

Syntax

Syntax:
vehicle setVectorDirAndUp [vectorDir, vectorUp]
Parameters:
vehicle: Object
vectorDir: Array format Vector3D - vectorDir
vectorUp: Array format Vector3D - vectorUp
Return Value:
Nothing

Examples

Example 1:
// set exact yaw, pitch, and roll _yaw = 45; _pitch = -80; _roll = 0; _myObject setVectorDirAndUp [ [sin _yaw * cos _pitch, cos _yaw * cos _pitch, sin _pitch], [[sin _roll, -sin _pitch, cos _roll * cos _pitch], -_yaw] call BIS_fnc_rotateVector2D ];
Example 2:
To rotate _myObject on Z axis 90 degrees clockwise, change its vectorDir but leave vectorUp unchanged.
_myObject setVectorDirAndUp [[1,0,0], [0,0,1]];
Example 3:
To rotate _myObject on Y axis 90 degrees clockwise, change its vectorUp but leave vectorDir unchanged.
_myObject setVectorDirAndUp [[0,1,0], [1,0,0]];
Example 4:
To rotate _myObject on X axis 90 degrees (tilt forward), change both vectorDir and vectorUp accordingly.
_myObject setVectorDirAndUp [[0,0,-1], [0,1,0]];
Example 5:
More complex orientations
// tilt forward 90 + rotate left 90 _myObject setVectorDirAndUp [[1,0,0], [0,1,0]]; // tilt backward 45 degrees _myObject setVectorDirAndUp [[0,0.5,0.5], [0,-0.5,0.5]]; // tilt forward 30 degrees _myObject setVectorDirAndUp [[0,0.66,-0.33], [0,0.33,0.66]];

Additional Information

See also:
vectorDir vectorUp setVectorDir setVectorUp vectorDiff vectorAdd vectorMultiply vectorCrossProduct vectorDistance vectorMagnitudeSqr vectorDistanceSqr vectorCos vectorMagnitude vectorDotProduct vectorNormalized vectorFromTo BIS_fnc_transformVectorDirAndUp

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
Str - c
Posted on Mar 16, 2008 - 09:50 (UTC)
Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank).
General Barron - c
Posted on May 09, 2008 - 09:32 (UTC)
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 (dead link)
Chris330 - c
Posted on Oct 23, 2009 - 18:39 (UTC)
Note this odd command may now be better understood. There's a thread about it here: BI Studios Forum Thread
ffur2007slx2_5 - c
Posted on Jun 01, 2014 - 18:45 (UTC)
Arma 3 logo black.png1.20 setDir overwrites setVectorDirAndUp (P.S. setVectorDirAndUp also affects setVelocity.), so use setDir before BIS_fnc_setPitchBank, which is an easier workaround on vector, if changing yaw, pitch and bank are needed. setVectorDirAndUp is CCW, so if we wanna to set an obj 40 degrees CW, 170 degrees pitch and 85 degrees bank:
_obj setDir (40 - 180); [_obj, 170, 85] call BIS_fnc_setPitchBank;
Same as:
_obj setVectorDirAndUp [[0.63,0.75,0.17],[-0.75,0.65,-0.084]];
Be aware that attachTo may flip vectorDir if pitch beyond 90 degrees and cause unexpected behavior to BIS_fnc_setPitchBank, e.g.
[_obj, 100, 0] call BIS_fnc_setPitchBank; // vector: [-0.14,-0.09,0.98],[-0.83,-0.51,-0.17]
_obj attachTo [_logic,[0,0,2]]; [_obj, 100, 0] call BIS_fnc_setPitchBank; // vector: [0.11,0.33,0.93],[-0.06,0.94,-0.32]
compass direction algorithm failed if obj was attached at present. To overcome such limitation we can use fallowing function for a better workaround. (code originated from 'bapedibupa, remodified)
_obj attachTo [_logic,[0,0,2]]; [_obj,[120,-78,37]] call fnc_SetPitchBankYaw; // pitch: 120, bank: -78, yaw: 37
fnc_SetPitchBankYaw = { private ["_object", "_rotations", "_aroundX", "_aroundY", "_aroundZ", "_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up", "_dirXTemp", "_upXTemp"]; _object = _this select 0; _rotations = _this select 1; _aroundX = _rotations select 0; _aroundY = _rotations select 1; _aroundZ = (360 - (_rotations select 2)) - 360; _dirX = 0; _dirY = 1; _dirZ = 0; _upX = 0; _upY = 0; _upZ = 1; if (_aroundX != 0) then { _dirY = cos _aroundX; _dirZ = sin _aroundX; _upY = -sin _aroundX; _upZ = cos _aroundX; }; if (_aroundY != 0) then { _dirX = _dirZ * sin _aroundY; _dirZ = _dirZ * cos _aroundY; _upX = _upZ * sin _aroundY; _upZ = _upZ * cos _aroundY; }; if (_aroundZ != 0) then { _dirXTemp = _dirX; _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ); _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ); _upXTemp = _upX; _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ); _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ); }; _dir = [_dirX,_dirY,_dirZ]; _up = [_upX,_upY,_upZ]; _object setVectorDirAndUp [_dir,_up]; };