2024-08-04 09:08:12 +00:00
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
[GlobalClass, Tool ]
|
2025-01-08 18:46:17 +00:00
|
|
|
public partial class LookAt : Action
|
2024-08-04 09:08:12 +00:00
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public Node3D lookTarget;
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
public Node3D lookFrom;
|
|
|
|
|
|
|
|
public override void _Process( double delta )
|
|
|
|
{
|
|
|
|
_OnTrigger();
|
|
|
|
}
|
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
protected override void _OnTrigger()
|
2024-08-04 09:08:12 +00:00
|
|
|
{
|
|
|
|
if ( lookFrom == null || lookTarget == null )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
lookFrom.LookAt( lookTarget.GlobalPosition );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|