rotation to vector2 godot
#include <Godot.hpp>
#include <Vector2.hpp>
using namespace godot;
Vector2 rotate_vector2(const Vector2 &v, float angle) {
float new_x = v.x Math::cos(angle) - v.y Math::sin(angle);
float new_y = v.x Math::sin(angle) + v.y Math::cos(angle);
return Vector2(new_x, new_y);
}
void register_methods() {
register_method("rotate_vector2", &rotate_vector2);
}