mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:35:34 +00:00
30 lines
No EOL
742 B
C#
30 lines
No EOL
742 B
C#
using Godot;
|
|
|
|
namespace Cirno.Scripts.Utils;
|
|
|
|
public static class QuakeTools
|
|
{
|
|
// Common inverse scale. Calculated as 1.0 / Inverse Scale Factor.
|
|
// Used to help translate properties using Quake Units into Godot Units.
|
|
public const float InverseScale = 0.03125f;
|
|
|
|
public static Vector3 IdVecToGodotVec(Variant vec)
|
|
{
|
|
var org = Vector3.Zero;
|
|
|
|
if (vec.Obj is Vector3 vec3)
|
|
{
|
|
org = vec3;
|
|
}
|
|
else if (vec.Obj is string vecs)
|
|
{
|
|
var arr = vecs.SplitFloats(" ");
|
|
for (int i = 0; i < Mathf.Max(arr.Length, 3); i++)
|
|
{
|
|
org[i] = arr[i];
|
|
}
|
|
}
|
|
|
|
return new Vector3(org.Y, org.Z, org.X);
|
|
}
|
|
} |