Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.60

Description

Description:Creates a rotation matrix for the given vector using the given angle. It can be used with the fn_vbs_rotateVector3D.

Syntax

Syntax:[vector, angle_offset] call fn_vbs_rotationMatrix
Parameters:
  • vector: Vector3D - Vector to rotate.
  • angle_offset: Number - Angle to offset the vector by.
Return Value:Vector3D

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:Rotate an object along its X axis and current upvector:
#include "\vbs2\headers\function_library.hpp"
while {true} do
{
    _upVector = vectorUp car;
    _vectorDir = vectorDir car;
    _xyRotM = [_upVector,-8] call fn_vbs_rotationMatrix;
    _vectorDir = [_vectorDir,_xyRotM] call fn_vbs_rotateVector3D;
    car setVectorDirAndUp [_vectorDir,_upVector];
    sleep .1;
};

Additional Information

See also:
Multiplayer:
Problems:

Notes






To clarify the example: the vector is rotated like a screw around the given vector. So, in the car example, a rotation matrix is being made to rotate a vector -8 degrees around the car's up vector. This is then used in fn_vbs_rotateVector3D to rotate the car's direction vector (direction vector is rotated -8 degrees around the up vector). --
General Barron
06:49, 23 August 2013 (PDT)