diff options
author | George Marques <george@gmarqu.es> | 2021-09-01 09:32:42 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-01 09:32:42 -0300 |
commit | cf59028972e013128703033bc2ef1677098138bf (patch) | |
tree | 55c06ac3be2230483b41eb349e8916dafaa975b7 /doc/classes/Vector2.xml | |
parent | ac7541c1b1f435587afb1d7b74129c813a1c84dc (diff) | |
parent | 3f3739ccb56fdadab79e17e6a5865381e0821228 (diff) |
Merge pull request #48237 from KoBeWi/they_came_from_angle
Add Vector2.from_angle() method
Diffstat (limited to 'doc/classes/Vector2.xml')
-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" /> |