BIS fnc roundDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[[cC]ategory:[fF]unctions\|\{\{uc:[a-z A-Z_]*\}\}\]\]" to "")
m (codecomment → cc)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| tkoh
|game1= tkoh


|1.00
|version1= 1.00


|gr1 = Math
|gr1= Math


| Round direction to nearest set rounding; used for determining cardinal direction.
|descr= Round direction to nearest set rounding; used for determining cardinal direction.


| [rawDirection, rounding] call [[BIS_fnc_roundDir]]
|s1= [rawDirection, rounding] call [[BIS_fnc_roundDir]]


|p1= rawDirection: [[Number]] - direction to round
|p1= rawDirection: [[Number]] - direction to round
Line 15: Line 15:
|p2= rounding: [[Number]] - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270.
|p2= rounding: [[Number]] - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270.


| [[Number]] - rounded direction, depending on input '''can be negative or over 360'''
|r1= [[Number]] - rounded direction, depending on input '''can be negative or over 360'''


|x1= <code>[[player]] [[setDir]] (<nowiki>[</nowiki>[[getDir]] [[player]], 45] [[call]] [[BIS_fnc_roundDir]]);</code>
|x1= <code>[[player]] [[setDir]] (<nowiki>[</nowiki>[[getDir]] [[player]], 45] [[call]] [[BIS_fnc_roundDir]]);</code>


|x2= <code>[204.2, 10] [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 200}}</code>
|x2= <code>[204.2, 10] [[call]] [[BIS_fnc_roundDir]]; {{cc|will return 200}}</code>


|x3= <code>[271, 180] [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 360}}</code>
|x3= <code>[271, 180] [[call]] [[BIS_fnc_roundDir]]; {{cc|will return 360}}</code>


|x4= <code>70 [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 90}}</code>
|x4= <code>70 [[call]] [[BIS_fnc_roundDir]]; {{cc|will return 90}}</code>


| [[setDir]], [[getRelDir]], [[round]]
|seealso= [[setDir]], [[getRelDir]], [[round]]
}}
}}


[[Category:{{Name|tkoh}}: Functions|{{uc:roundDir}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:roundDir}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:roundDir}}]]

Revision as of 17:00, 7 February 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