2025-10-24 11:38:51 +00:00
|
|
|
using Godot;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
|
{
|
|
|
|
|
public static class BasisExtensions
|
|
|
|
|
{
|
2026-02-26 14:06:27 +00:00
|
|
|
public static Vector3 Forward( this Basis self )
|
|
|
|
|
{
|
|
|
|
|
return -self.Z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Vector3 Right( this Basis self )
|
|
|
|
|
{
|
|
|
|
|
return self.X;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Vector3 Up( this Basis self )
|
|
|
|
|
{
|
|
|
|
|
return self.Y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Vector3 ToGlobalDirection( this Basis self, Vector3 direction )
|
|
|
|
|
{
|
|
|
|
|
return self.Right() * direction.X + self.Up() * direction.Y + self.Forward() * direction;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-24 11:38:51 +00:00
|
|
|
public static bool IsValid( this Basis self )
|
|
|
|
|
{
|
|
|
|
|
return self.Row0.IsValid() && self.Row1.IsValid() && self.Row2.IsValid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|