mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 19:35:55 +00:00
Triggerable movable walls
This commit is contained in:
parent
f3edc2b433
commit
9d0036c436
20 changed files with 1292 additions and 693 deletions
30
Scripts/Utils/QuakeTools.cs
Normal file
30
Scripts/Utils/QuakeTools.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue