Arma 3 Scripting

BIS_fnc_transformVectorDirAndUp

  • Arma 3 v1.98

Function · Markdown · JSON · original wiki page

Description

Rotates both vectorDir and vectorUp on 3 axes: z (yaw), x (pitch) and y (roll). Positive angle direction is according to the right hand rule.

Note

The vectors are rotated first on z axis then on x axis then on y axis. For example standard [[0,1,0],[0,0,1]] pair rotated 90 degrees on every axis will result in [[0,0,1],[0,-1,0]]

Syntax

[vectorDirAndUp, yaw, pitch, roll] call BIS_fnc_transformVectorDirAndUp

Parameters:

Returns: Array in format [vectorDir, vectorUp]

Examples

Example 1

private _vDirUp = [[vectorDirVisual uav, vectorUpVisual uav], 0, 0, 90] call BIS_fnc_transformVectorDirAndUp;

Example 2

Create UAV object and make it pitch with mouse up/down and roll with mouse left/right:

uav = "B_UAV_05_F" createVehicle [0,0,0];
uav attachTo [player, [0,30,10]];
findDisplay 46 displayAddEventHandler ["MouseMoving",
{
    uav setVectorDirAndUp
    (
        [
            [vectorDirVisual uav, vectorUpVisual uav],
            getDirVisual uav,
            _this select 2,
            _this select 1
        ]
        call BIS_fnc_transformVectorDirAndUp
    );
}];

See also

vectorDir · vectorUp · setVectorDirAndUp