Merge pull request #43072 from KoBeWi/point_to_angle
This commit is contained in:
commit
d975b1bc37
2 changed files with 2 additions and 1 deletions
|
@ -79,7 +79,7 @@ real_t Vector2::angle_to(const Vector2 &p_vector2) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
real_t Vector2::angle_to_point(const Vector2 &p_vector2) const {
|
real_t Vector2::angle_to_point(const Vector2 &p_vector2) const {
|
||||||
return (*this - p_vector2).angle();
|
return (p_vector2 - *this).angle();
|
||||||
}
|
}
|
||||||
|
|
||||||
real_t Vector2::dot(const Vector2 &p_other) const {
|
real_t Vector2::dot(const Vector2 &p_other) const {
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
<argument index="0" name="to" type="Vector2" />
|
<argument index="0" name="to" type="Vector2" />
|
||||||
<description>
|
<description>
|
||||||
Returns the angle between the line connecting the two points and the X axis, in radians.
|
Returns the angle between the line connecting the two points and the X axis, in radians.
|
||||||
|
[code]a.angle_to_point(b)[/code] is equivalent of doing [code](b - a).angle()[/code].
|
||||||
[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/vector2_angle_to_point.png]Illustration of the returned angle.[/url]
|
[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/vector2_angle_to_point.png]Illustration of the returned angle.[/url]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
|
Loading…
Reference in a new issue