getRelDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


|arma3|= Game name
|game1= arma3
|version1= 1.56


|1.56|= Game version
|arg= global


|arg= global|= Arguments in MP
|gr1= Object Manipulation
____________________________________________________________________________________________


| Returns direction, which is relative to object's current direction, from given object to another object or position in the range from 0 to 360, the equivalent of [[BIS_fnc_relativeDirTo]]. Taking the current [[direction]] of the object into account. |= Description
|descr= Returns direction, which is relative to object's current direction, from given object to another object or position in the range from 0 to 360, the equivalent of [[BIS_fnc_relativeDirTo]].
____________________________________________________________________________________________
Taking the current [[direction]] of the object into account.


| object '''getRelDir''' position |= Syntax
|s1= object [[getRelDir]] position


|p1= object: [[Object]] |=Parameter 1
|p1= object: [[Object]]
|p2= position: [[Object]], [[Position2D]] or [[Position3D]] |=Parameter 2
| [[Number]] |= Return value
____________________________________________________________________________________________
|x1 = <code>_reldir = [[player]] '''getRelDir''' tank;</code> |= Example 1
____________________________________________________________________________________________
| [[getDir]], [[direction]], [[getDirVisual]] |= See also


}}
|p2= position: [[Object]], [[Position#Introduction|Position2D]] or [[Position#Introduction|Position3D]]


<h3 style="display:none">Notes</h3>
|r1= [[Number]]
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x1= <sqf>_reldir = player getRelDir tank;</sqf>
</dl>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[getDir]] [[direction]] [[getDirVisual]]
}}


[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
<dl class="command_description">
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
<dt></dt>
<dl class="command_description">
<dd class="notedate">Posted on 2018-08-07 - 21:50 (UTC)</dd>
<dd class="notedate">Posted on August 7, 2018 - 21:50 (UTC)</dd>
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dd class="note">
<dd class="note">
To clarify, this returns a relative direction, so objects directly in front are said to be at zero degrees. So, taking example 1 above, if the tank is in front of the player, this function will return 0. If the tank is to the right of the player, it will return 90.
To clarify, this returns a relative direction, so objects directly in front are said to be at zero degrees. So, taking example 1 above, if the tank is in front of the player, this function will return 0. If the tank is to the right of the player, it will return 90.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
 
{{Note
|user= Hypoxic125
|timestamp= 20230519053316
|text= Set unit's direction towards any given position:
<sqf>
_unit setDir (getDir _unit + (_unit getRelDir [_x, _y, _z]));
</sqf>
}}

Latest revision as of 07:33, 19 May 2023

Hover & click on the images for description

Description

Description:
Returns direction, which is relative to object's current direction, from given object to another object or position in the range from 0 to 360, the equivalent of BIS_fnc_relativeDirTo. Taking the current direction of the object into account.
Groups:
Object Manipulation

Syntax

Syntax:
object getRelDir position
Parameters:
object: Object
position: Object, Position2D or Position3D
Return Value:
Number

Examples

Example 1:
_reldir = player getRelDir tank;

Additional Information

See also:
getDir direction getDirVisual

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
Posted on 2018-08-07 - 21:50 (UTC)
Tankbuster
To clarify, this returns a relative direction, so objects directly in front are said to be at zero degrees. So, taking example 1 above, if the tank is in front of the player, this function will return 0. If the tank is to the right of the player, it will return 90.
Hypoxic125 - c
Posted on May 19, 2023 - 05:33 (UTC)
Set unit's direction towards any given position:
_unit setDir (getDir _unit + (_unit getRelDir [_x, _y, _z]));