getAimDirectionAndUp: Difference between revisions

From Bohemia Interactive Community
(Created page with "{{RV|type=command |game1= arma3 |version1= 2.22 |arg= global |gr1= Object Manipulation |gr2= Render Time Scope |descr= Returns the aim direction and up vectors of a soldier in model space. It returns where the weapon aim is wanted, not the actual weapon direction. For actual weapon direction, see weaponDirection. |s1= getAimDirectionAndUp [soldier, isRenderScope] |p1= soldier: Object - The soldier entity. The soldier must either be on foot or in a turre...")
 
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 9: Line 9:
|gr2= Render Time Scope
|gr2= Render Time Scope


|descr= Returns the aim direction and up vectors of a soldier in model space. It returns where the weapon aim is wanted, not the actual weapon direction. For actual weapon direction, see [[weaponDirection]].
|descr= Returns the aim direction and up vectors of a soldier in model space. It returns where the weapon aim is wanted from the [[eyePos]], not the actual weapon direction. For actual weapon direction, see [[weaponDirection]].


|s1= [[getAimDirectionAndUp]] [soldier, isRenderScope]
|s1= [[getAimDirectionAndUp]] [soldier, isRenderScope]
Line 19: Line 19:
|r1= [[Array]] - in format [directionForward, directionUp] in soldier's model space
|r1= [[Array]] - in format [directionForward, directionUp] in soldier's model space


|x1= <sqf>getAimDirectionAndUp [player] params ["_dir", "_up"];</sqf>
|x1= <sqf>onEachFrame
{
    getAimDirectionAndUp [player] params ["_dir", "_up"];
    private _dirWS = player vectorModelToWorld _dir;
    private _upWS = player vectorModelToWorld _up;
    private _eyePos = eyePos player;
    drawLine3D [ASLtoAGL _eyePos, ASLtoAGL (_eyePos vectorAdd _dirWS), [1,0,0,1]];
}
</sqf>


|seealso= [[weaponDirection]] [[eyeDirection]] [[positionCameraToWorld]]
|seealso= [[weaponDirection]] [[eyeDirection]] [[positionCameraToWorld]] [[eyePos]]
}}
}}

Latest revision as of 12:14, 31 March 2026

Hover & click on the images for description

Description

Description:
Returns the aim direction and up vectors of a soldier in model space. It returns where the weapon aim is wanted from the eyePos, not the actual weapon direction. For actual weapon direction, see weaponDirection.
Groups:
Object ManipulationRender Time Scope

Syntax

Syntax:
getAimDirectionAndUp [soldier, isRenderScope]
Parameters:
soldier: Object - The soldier entity. The soldier must either be on foot or in a turret.
isRenderScope: Boolean - (Optional, default false) Whether to use render scope to get the vector. (render scope is smoother for visualizing the vector in 3D)
Return Value:
Array - in format [directionForward, directionUp] in soldier's model space

Examples

Example 1:
onEachFrame { getAimDirectionAndUp [player] params ["_dir", "_up"]; private _dirWS = player vectorModelToWorld _dir; private _upWS = player vectorModelToWorld _up; private _eyePos = eyePos player; drawLine3D [ASLtoAGL _eyePos, ASLtoAGL (_eyePos vectorAdd _dirWS), [1,0,0,1]]; }

Additional Information

See also:
weaponDirection eyeDirection positionCameraToWorld eyePos

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note