feat: add rotation vector functions

This commit is contained in:
huaqo-games
2025-11-06 11:30:33 +01:00
parent c488ac4c40
commit 56748f1fd8
+13
View File
@@ -12,3 +12,16 @@ Vector2 GetRandomVector(const Rectangle bounds) {
};
}
Vector2 RotationToVector2(float rotation)
{
float rad = rotation * (PI / 180.0f);
Vector2 vec = { cosf(rad), sinf(rad) };
return vec;
}
float Vector2ToRotation(Vector2 vec)
{
float rad = atan2f(vec.y, vec.x);
float deg = rad * (180.0f / PI);
return deg;
}