BIS fnc roundDir: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
||
Line 1: | Line 1: | ||
{{Function|Comments= | {{Function|Comments= | ||
| tkoh |Game name= | | tkoh |Game name= | ||
Line 7: | Line 6: | ||
|gr1 = Math |GROUP1= | |gr1 = Math |GROUP1= | ||
| Round direction to nearest set rounding; used for determining cardinal direction. |DESCRIPTION= | | Round direction to nearest set rounding; used for determining cardinal direction. |DESCRIPTION= | ||
| [rawDirection, rounding] call [[BIS_fnc_roundDir]] |SYNTAX= | | [rawDirection, rounding] call [[BIS_fnc_roundDir]] |SYNTAX= | ||
Line 19: | Line 16: | ||
| [[Number]] - rounded direction, depending on input '''can be negative or over 360''' |RETURNVALUE= | | [[Number]] - rounded direction, depending on input '''can be negative or over 360''' |RETURNVALUE= | ||
|x1= <code>[[player]] [[setDir]] (<nowiki>[</nowiki>[[getDir]] [[player]], 45] [[call]] [[BIS_fnc_roundDir]]);</code> |EXAMPLE1= | |x1= <code>[[player]] [[setDir]] (<nowiki>[</nowiki>[[getDir]] [[player]], 45] [[call]] [[BIS_fnc_roundDir]]);</code> |EXAMPLE1= | ||
Line 28: | Line 24: | ||
|x4= <code>70 [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 90}}</code> |EXAMPLE4= | |x4= <code>70 [[call]] [[BIS_fnc_roundDir]]; {{codecomment|// will return 90}}</code> |EXAMPLE4= | ||
| [[setDir]], [[getRelDir]], [[round]] |SEEALSO= | | [[setDir]], [[getRelDir]], [[round]] |SEEALSO= |
Revision as of 23:43, 16 January 2021
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
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