1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add Vector2.from_angle() method

This commit is contained in:
kobewi
2021-04-27 15:53:04 +02:00
parent d085b2d04d
commit 3f3739ccb5
5 changed files with 30 additions and 0 deletions

View File

@@ -34,6 +34,10 @@ real_t Vector2::angle() const {
return Math::atan2(y, x);
}
Vector2 Vector2::from_angle(const real_t p_angle) {
return Vector2(Math::cos(p_angle), Math::sin(p_angle));
}
real_t Vector2::length() const {
return Math::sqrt(x * x + y * y);
}