BIS fnc roundDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (Some wiki formatting)
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= tkoh
____________________________________________________________________________________________
|version1= 1.00


| tkoh |= Game name
|game2= arma3
|version2= 0.50


|1.00|= Game version
|gr1= Math
____________________________________________________________________________________________


| <pre>/*
|descr= Round direction to nearest set rounding; used for determining cardinal direction.


Description:
|s1= [rawDirection, rounding] call [[BIS_fnc_roundDir]]
Round direction to nearest limit
(used for determining cardinal direction)


Parameter(s):
|p1= rawDirection: [[Number]] - direction to round
_this select 0: NUMBER - direction
_this select 1 (Optional): NUMBER - limit direction (default: 90)


Returns:
|p2= rounding: [[Number]] - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270
NUMBER - rounded direction
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|r1= [[Number]] - rounded direction, depending on input. '''Can be negative or over 360'''
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_roundDir]]; --> |= Syntax
|x1= <sqf>player setDir ([getDir player, 45] call BIS_fnc_roundDir);</sqf>


|p1= |= Parameter 1
|x2= <sqf>[204.2, 10] call BIS_fnc_roundDir; // will return 200</sqf>


| |= Return value
|x3= <sqf>[271, 180] call BIS_fnc_roundDir; // will return 360</sqf>
____________________________________________________________________________________________


|x1= <code></code> |=
|x4= <sqf>70 call BIS_fnc_roundDir; // will return 90</sqf>
____________________________________________________________________________________________
 
| |= See also


|seealso= [[setDir]] [[getRelDir]] [[round]]
}}
}}
<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:Function Group: Misc|{{uc:roundDir}}]]
[[Category:Functions|{{uc:roundDir}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:roundDir}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:roundDir}}]]

Latest revision as of 13:12, 13 July 2022

Hover & click on the images for description

Description

Description:
Round direction to nearest set rounding; used for determining cardinal direction.
Execution:
call
Groups:
Math

Syntax

Syntax:
[rawDirection, rounding] call BIS_fnc_roundDir
Parameters:
rawDirection: Number - direction to round
rounding: Number - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270
Return Value:
Number - rounded direction, depending on input. Can be negative or over 360

Examples

Example 1:
player setDir ([getDir player, 45] call BIS_fnc_roundDir);
Example 2:
[204.2, 10] call BIS_fnc_roundDir; // will return 200
Example 3:
[271, 180] call BIS_fnc_roundDir; // will return 360
Example 4:
70 call BIS_fnc_roundDir; // will return 90

Additional Information

See also:
setDir getRelDir round

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