42 lines
637 B
C#
42 lines
637 B
C#
|
|
using Godot;
|
|
|
|
|
|
namespace Rokojori
|
|
{
|
|
[GlobalClass, Tool ]
|
|
public partial class CopyPosition : Action
|
|
{
|
|
[Export]
|
|
public Node3D source;
|
|
|
|
[Export]
|
|
public Node3D target;
|
|
|
|
[Export]
|
|
public bool global = true;
|
|
|
|
|
|
// public override void _Process( double delta )
|
|
// {
|
|
// _OnTrigger();
|
|
// }
|
|
|
|
protected override void _OnTrigger()
|
|
{
|
|
if ( source == null || target == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if ( global )
|
|
{
|
|
target.GlobalPosition = source.GlobalPosition;
|
|
}
|
|
else
|
|
{
|
|
target.Position = source.Position;
|
|
}
|
|
}
|
|
}
|
|
} |