Add rotate_toward and angle_difference to GDScript and C#

This commit is contained in:
etti
2023-09-04 12:04:40 +02:00
parent 0ca8542329
commit 3a39de4e2f
6 changed files with 158 additions and 12 deletions
+19
View File
@@ -85,6 +85,14 @@
[/codeblock]
</description>
</method>
<method name="angle_difference">
<return type="float" />
<param index="0" name="from" type="float" />
<param index="1" name="to" type="float" />
<description>
Returns the difference between the two angles, in the range of [code][-PI, +PI][/code]. When [param from] and [param to] are opposite, returns [code]-PI[/code] if [param from] is smaller than [param to], or [code]PI[/code] otherwise.
</description>
</method>
<method name="asin">
<return type="float" />
<param index="0" name="x" type="float" />
@@ -1110,6 +1118,17 @@
Creates a RID from a [param base]. This is used mainly from native extensions to build servers.
</description>
</method>
<method name="rotate_toward">
<return type="float" />
<param index="0" name="from" type="float" />
<param index="1" name="to" type="float" />
<param index="2" name="delta" type="float" />
<description>
Rotates [param from] toward [param to] by the [param delta] amount. Will not go past [param to].
Similar to [method move_toward], but interpolates correctly when the angles wrap around [constant @GDScript.TAU].
If [param delta] is negative, this function will rotate away from [param to], toward the opposite angle, and will not go past the opposite angle.
</description>
</method>
<method name="round">
<return type="Variant" />
<param index="0" name="x" type="Variant" />