diff options
author | kobewi <kobewi4e@gmail.com> | 2021-04-27 15:53:04 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2021-08-31 01:53:58 +0200 |
commit | 3f3739ccb56fdadab79e17e6a5865381e0821228 (patch) | |
tree | 23fce9717b71c7efd76640d71642c744cc273bd0 /doc/classes | |
parent | d085b2d04d6a6f972cc252532dbbf07f0d54fc3c (diff) |
Add Vector2.from_angle() method
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/Vector2.xml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index cb5662419e..ab4d0e181a 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -155,6 +155,18 @@ Returns the vector with all components rounded down (towards negative infinity). </description> </method> + <method name="from_angle" qualifiers="static"> + <return type="Vector2" /> + <argument index="0" name="angle" type="float" /> + <description> + Creates a unit [Vector2] rotated to the given [code]angle[/code] in radians. This is equivalent to doing [code]Vector2(cos(angle), sin(angle))[/code] or [code]Vector2.RIGHT.rotated(angle)[/code]. + [codeblock] + print(Vector2.from_angle(0)) # Prints (1, 0). + print(Vector2(1, 0).angle()) # Prints 0, which is the angle used above. + print(Vector2.from_angle(PI / 2)) # Prints (0, 1). + [/codeblock] + </description> + </method> <method name="is_equal_approx" qualifiers="const"> <return type="bool" /> <argument index="0" name="to" type="Vector2" /> |