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

30 lines
473 B
C#
Raw Normal View History

2024-08-04 09:08:12 +00:00
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 );
}
}
}