rj-action-library/Runtime/Actions/Node3D/LookAt.cs

30 lines
473 B
C#

using Godot;
namespace Rokojori
{
[GlobalClass, Tool ]
public partial class LookAt : RJAction
{
[Export]
public Node3D lookTarget;
[Export]
public Node3D lookFrom;
public override void _Process( double delta )
{
_OnTrigger();
}
public override void _OnTrigger()
{
if ( lookFrom == null || lookTarget == null )
{
return;
}
lookFrom.LookAt( lookTarget.GlobalPosition );
}
}
}