Hello,
I am implementing a simple spawner in 2D mode. My aim is to make them (each node) spawn with a 30-degree angle.
In Unity, I can solve this problem via Euler.
Vector2 v = Vector2.zero - base.transform.position;
v = Quaternion.Euler(0f, 0f, 30f) * v;
In Godot, how can I create a function that is exactly equivalent?
Currently, my implementation is:
var vector = target.position - position
var right = Quat(Vector3(vector.x, vector.y, 0), 30);
var left = Quat(Vector3(vector.x, vector.y, 0), -30);
if index == 1:
vector.x = right.get_euler().x * vector.x;
vector.y = right.get_euler().y * vector.y;
elif index == 2:
vector.x = left.get_euler().x * vector.x;
vector.y = left.get_euler().y * vector.y;
But it works wrong. The 'left' is throwing the back side and the angle of both 'left' and 'right' is not 30 degrees.