rokojori_action_library/Runtime/Godot/Extensions/BasisExtensions.cs

35 lines
744 B
C#

using Godot;
using System.Text;
using System.Collections.Generic;
using System.Linq;
namespace Rokojori
{
public static class BasisExtensions
{
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;
}
public static bool IsValid( this Basis self )
{
return self.Row0.IsValid() && self.Row1.IsValid() && self.Row2.IsValid();
}
}
}