32 lines
684 B
C#
32 lines
684 B
C#
|
|
using Godot;
|
|
using Rokojori;
|
|
|
|
namespace GameJam
|
|
{
|
|
[GlobalClass]
|
|
public partial class CopyTransform:Node
|
|
{
|
|
[Export]
|
|
public Node3D source;
|
|
|
|
[Export]
|
|
public Node3D target;
|
|
|
|
[Export]
|
|
public float rotationSpeed;
|
|
|
|
public override void _Process( double delta )
|
|
{
|
|
target.GlobalPosition = source.GlobalPosition;
|
|
//target.GlobalRotation = source.GlobalRotation;
|
|
|
|
var rotationBefore = target.GlobalBasis.GetRotationQuaternion();
|
|
var rotationAfter = source.GlobalBasis.GetRotationQuaternion();
|
|
|
|
var lerped = rotationBefore.Slerp( rotationAfter, rotationSpeed );
|
|
|
|
Math3D.SetGlobalRotation( target, lerped );
|
|
}
|
|
}
|
|
} |