Description
Set object's up vector. Direction of the object remain unchanged. Default object's vectorUp is [0,0,1].
Syntax
object setVectorUp vectorUp
Parameters:
Returns: 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;
See also
vectorDir · vectorUp · setVectorDir · setVectorDirAndUp · vectorDiff · vectorAdd · vectorMultiply · vectorCrossProduct · vectorDistance · vectorMagnitudeSqr · vectorDistanceSqr · vectorCos · vectorMagnitude · vectorDotProduct · vectorNormalized · vectorFromTo
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.
An in-depth discussion on the concept of vectors is available here.
Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank).
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];
_ammobox setVectorUp [1, 0, 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 attachTo [player, [0, 2, 1]];
_ammobox setVectorUp [0, 0.99, 0.01];
_ammobox setVectorUp [0.99, 0, 0.01];