BIS fnc rotateVector2D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 49: Line 49:
[[Category:{{Name|tkoh}}: Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:rotateVector2D}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on January 21, 2015 - 14:15 (UTC)</dd>
<dt class="note">[[User:AgentRevolution|AgentRevolution]]</dt>
<dd class="note">
Be careful when using this function in conjunction with [[getDir]] or [[BIS_fnc_dirTo]]; they return a clockwise angle, while the rotation is done counterclockwise (mathematically correct).
<br/>
To counter this, simply negate their output:
<code>[<nowiki>[0,1,0]</nowiki>, '''-('''[[getDir]] _object''')'''] [[call]] BIS_fnc_rotateVector2D;</code>
<code>[<nowiki>[0,1,0]</nowiki>, '''-('''[_unit, _vehicle] [[call]] [[BIS_fnc_dirTo]]''')'''] [[call]] BIS_fnc_rotateVector2D;</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 16:15, 21 January 2015

Hover & click on the images for description

Description

Description:
/************************************************************
	Rotate 2D Vector

Parameters: [[vector], angle]
Returns: [vector]

This function returns a 2D vector rotated a specified number
of degrees around the origin.
************************************************************/

(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
Syntax needed
Return Value:
Return value needed

Examples

Example 1:

Additional Information

See also:
See also needed

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

Notes

Bottom Section

Posted on January 21, 2015 - 14:15 (UTC)
AgentRevolution
Be careful when using this function in conjunction with getDir or BIS_fnc_dirTo; they return a clockwise angle, while the rotation is done counterclockwise (mathematically correct).
To counter this, simply negate their output: [[0,1,0], -(getDir _object)] call BIS_fnc_rotateVector2D; [[0,1,0], -([_unit, _vehicle] call BIS_fnc_dirTo)] call BIS_fnc_rotateVector2D;