mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-07 18:36:27 +00:00
ADDED: Vector3Angle()
This commit is contained in:
@@ -470,6 +470,21 @@ RMDEF float Vector3Distance(Vector3 v1, Vector3 v2)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate angle between two vectors in XY and XZ
|
||||||
|
RMDEF Vector2 Vector3Angle(Vector3 v1, Vector3 v2)
|
||||||
|
{
|
||||||
|
Vector2 result = { 0 };
|
||||||
|
|
||||||
|
float dx = v2.x - v1.x;
|
||||||
|
float dy = v2.y - v1.y;
|
||||||
|
float dz = v2.z - v1.z;
|
||||||
|
|
||||||
|
result.x = atan2f(dx, dz); // Angle in XZ
|
||||||
|
result.y = atan2f(dy, sqrtf(dx*dx + dz*dz)); // Angle in XY
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Negate provided vector (invert direction)
|
// Negate provided vector (invert direction)
|
||||||
RMDEF Vector3 Vector3Negate(Vector3 v)
|
RMDEF Vector3 Vector3Negate(Vector3 v)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user