BIS fnc transformVectorDirAndUp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - "{{Feature|Informative|" to "{{Feature|informative|")
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function|Comments=
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.98


|1.98|Game version=
|gr1= Vectors


|gr1 = Vectors |GROUP1=
|descr= [[File:transformVectorUpAndDir.jpg|300px|right]]
Rotates both [[vectorDir]] and [[vectorUp]] on 3 axes: z (yaw), x (pitch) and y (roll). Positive angle direction is according to the {{Link|https://en.wikipedia.org/wiki/Right-hand_rule|right hand rule}}.
{{Feature|informative| 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]]}}


| Rotates both [[vectorDir]] and [[vectorUp]] on 3 axes: z (yaw), x (pitch) and y (roll). Positive angle direction is according to the [https://en.wikipedia.org/wiki/Right-hand_rule right hand rule].<br><br>
|s1= [vectorDirAndUp, yaw, pitch, roll] call [[BIS_fnc_transformVectorDirAndUp]]


{{Informative| 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]]}}
|p1= vectorDirAndUp: [[Array]] in format [vectorDir, vectorUp] -(Optional, default [[0,1,0],[0,0,1]])
[[Image:transformVectorUpAndDir.jpg|400px]]|DESCRIPTION=


| [vectorDirAndUp, yaw, pitch, roll] call [[BIS_fnc_transformVectorDirAndUp]]; |SYNTAX=
|p2= yaw: [[Number]] - (Optional, default 0) yaw angle


|p1=[vectorDirAndUp, yaw, pitch, roll]: [[Array]]|PARAMETER1=
|p3= pitch: [[Number]] - (Optional, default 0) pitch angle
|p2= vectorDirAndUp (Optional): [[Array]] in format [vectorDir, vectorUp]. Default: [[0,1,0],[0,0,1]]|PARAMETER2=
|p3= yaw (Optional): [[Number]] - yaw angle. Default: 0 |PARAMETER3=
|p4= pitch (Optional): [[Number]] - pitch angle. Default: 0 |PARAMETER4=
|p5= roll (Optional): [[Number]] - roll angle. Default: 0 |PARAMETER5=


| [[Array]] in format [vectorDir, vectorUp] |RETURNVALUE=
|p4= roll: [[Number]] - (Optional, default 0) roll angle


|x1= <code>_vDirUp = <nowiki>[[</nowiki>[[vectorDirVisual]] uav, [[vectorUpVisual]] uav], 0, 0, 90] [[call]] [[BIS_fnc_transformVectorDirAndUp]];</code> |Example1=
|r1= [[Array]] in format [vectorDir, vectorUp]


|x2= Create UAV object and make it pitch with mouse up/down and roll with mouse left/right: <code>uav = "B_UAV_05_F" [[createVehicle]] [0,0,0];
|x1= <sqf>private _vDirUp = [[vectorDirVisual uav, vectorUpVisual uav], 0, 0, 90] call BIS_fnc_transformVectorDirAndUp;</sqf>
uav [[attachTo]] [<nowiki/>[[player]], [0,30,10]];
 
[[findDisplay]] 46 [[displayAddEventHandler]] ["MouseMoving",  
|x2= Create UAV object and make it pitch with mouse up/down and roll with mouse left/right:
<sqf>
uav = "B_UAV_05_F" createVehicle [0,0,0];
uav attachTo [player, [0,30,10]];
findDisplay 46 displayAddEventHandler ["MouseMoving",  
{
{
uav [[setVectorDirAndUp]]
uav setVectorDirAndUp
(
(
[
[
<nowiki>[</nowiki>[[vectorDirVisual]] uav, [[vectorUpVisual]] uav],  
[vectorDirVisual uav, vectorUpVisual uav],
[[getDirVisual]] uav,  
getDirVisual uav,
[[_this]] [[select]] 2,  
_this select 2,
[[_this]] [[select]] 1
_this select 1
]  
]
[[call]] [[BIS_fnc_transformVectorDirAndUp]]
call BIS_fnc_transformVectorDirAndUp
);
);
}];</code> |=
}];
 
</sqf>
| [[vectorDir]], [[vectorUp]], [[setVectorDirAndUp]] |SEEALSO=


|seealso= [[vectorDir]] [[vectorUp]] [[setVectorDirAndUp]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Functions|{{uc:transformVectorDirAndUp}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:transformVectorDirAndUp}}]]

Latest revision as of 00:25, 2 February 2024

Hover & click on the images for description

Description

Description:
transformVectorUpAndDir.jpg

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.

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]]
Execution:
call
Groups:
Vectors

Syntax

Syntax:
[vectorDirAndUp, yaw, pitch, roll] call BIS_fnc_transformVectorDirAndUp
Parameters:
vectorDirAndUp: Array in format [vectorDir, vectorUp] -(Optional, default [[0,1,0],[0,0,1]])
yaw: Number - (Optional, default 0) yaw angle
pitch: Number - (Optional, default 0) pitch angle
roll: Number - (Optional, default 0) roll angle
Return Value:
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 ); }];

Additional Information

See also:
vectorDir vectorUp setVectorDirAndUp

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