BIS fnc roundDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|game1= tkoh \|version1= 1\.([0-9]{2}) " to "|game1= tkoh |version1= 1.$1 |game2= arma3 |version2= 0.50 ")
m (Text replacement - " \[\[Category:\{\{Name|[a-z0-9]+\}\}: Functions\|\{\{uc:[a-zA-Z0-9]+\}\}\]\]" to "")
Line 29: Line 29:
|seealso= [[setDir]], [[getRelDir]], [[round]]
|seealso= [[setDir]], [[getRelDir]], [[round]]
}}
}}
 
|
[[Category:{{Name|arma3}}: Functions|{{uc:roundDir}}]]

Revision as of 00:02, 17 June 2021

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:
setDirgetRelDirround

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

|