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

45 lines
737 B
C#
Raw Normal View History

2025-01-03 12:09:23 +00:00
using Godot;
namespace Rokojori
{
[Tool][GlobalClass ]
2025-01-08 18:46:17 +00:00
public partial class CopyPose : Action
2025-01-03 12:09:23 +00:00
{
[Export]
public Node3D source;
[Export]
public Node3D target;
2025-06-23 11:16:01 +00:00
[Export]
public bool global = true;
2025-01-03 12:09:23 +00:00
2025-06-23 11:16:01 +00:00
// public override void _Process( double delta )
// {
// _OnTrigger();
// }
2025-01-03 12:09:23 +00:00
2025-01-08 18:46:17 +00:00
protected override void _OnTrigger()
2025-01-03 12:09:23 +00:00
{
if ( source == null || target == null )
{
return;
}
2025-06-23 11:16:01 +00:00
if ( global )
{
target.GlobalPosition = source.GlobalPosition;
target.GlobalRotation = source.GlobalRotation;
}
else
{
target.Position = source.Position;
target.Rotation = source.Rotation;
}
2025-01-03 12:09:23 +00:00
}
}
}