31 lines
512 B
C#
31 lines
512 B
C#
|
|
using Godot;
|
|
|
|
|
|
namespace Rokojori
|
|
{
|
|
[GlobalClass ]
|
|
public partial class CopyMousePosition : RJAction
|
|
{
|
|
[Export]
|
|
public Camera3D camera;
|
|
|
|
[Export]
|
|
public float depth;
|
|
|
|
[Export]
|
|
public Node3D target;
|
|
|
|
|
|
public override void _OnTrigger()
|
|
{
|
|
if ( camera == null || target == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
var mousePosition = GetViewport().GetMousePosition();
|
|
target.GlobalPosition = camera.ProjectPosition( mousePosition, depth );
|
|
}
|
|
}
|
|
} |