40 lines
838 B
C#
40 lines
838 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using Godot;
|
||
|
using System.Text;
|
||
|
using System;
|
||
|
|
||
|
namespace Rokojori
|
||
|
{
|
||
|
public class Math3D
|
||
|
{
|
||
|
public static Quaternion GetGlobalRotation( Node3D node )
|
||
|
{
|
||
|
return node.GlobalBasis.GetRotationQuaternion();
|
||
|
}
|
||
|
|
||
|
public static void SetGlobalRotation( Node3D node, Quaternion quaternion )
|
||
|
{
|
||
|
var forward = quaternion * Vector3.Forward;
|
||
|
var up = quaternion * Vector3.Up;
|
||
|
|
||
|
node.LookAt( node.GlobalPosition + forward, up );
|
||
|
}
|
||
|
|
||
|
public static Vector3 GetGlobalForward( Node3D node )
|
||
|
{
|
||
|
return node.GlobalBasis.Z;
|
||
|
}
|
||
|
|
||
|
public static Vector3 GetGlobalUp( Node3D node )
|
||
|
{
|
||
|
return node.GlobalBasis.Y;
|
||
|
}
|
||
|
|
||
|
public static Vector3 GetGlobalRight( Node3D node )
|
||
|
{
|
||
|
return node.GlobalBasis.X;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|