I had this setup for my character

Some simple code following some tutorial. And all was good, 2d character was moving. Then I though hey i wanna to separate controller code into his own script. So I added parent node like this:

and tried to update parent node's position like this

public override void _PhysicsProcess(double delta)
{
	GlobalPosition = controller.GlobalPosition;
}

And now my character is super fast and impossible to stop. What am i doing wrong here? What is right to do?
Code:

using Godot;
namespace Characters.Player;

public partial class Controller : CharacterBody2D
{
	[Export] public float MoveSpeed { get; private set; } = 100f;
	[Export] public Vector2 StartingDirection { get; private set; } = new(0, 1);

	private AnimationTree animationTree;
	private AnimationNodeStateMachinePlayback stateMachine;
	private AnimationPlayer animationPlayer;
	private Sprite2D movementSprites;
	private Sprite2D actionSprites;

	public override void _Ready()
	{
		animationTree = GetNode<AnimationTree>("AnimationTree");
		stateMachine = (AnimationNodeStateMachinePlayback)animationTree.Get("parameters/playback");
		animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
		movementSprites = GetNode<Sprite2D>("MovementSprites");
		actionSprites = GetNode<Sprite2D>("ActionSprites");

		UpdateAnimationParameters(StartingDirection);
	}

	public override void _PhysicsProcess(double delta)
	{
		if (Input.IsActionPressed("dig"))
		{
			animationPlayer.Play("dig_down");
			actionSprites.Visible = true;
			movementSprites.Visible = false;
			return;
		}

		actionSprites.Visible = false;
		movementSprites.Visible = true;

		var inputDirection = GetInputDirection();
		Velocity = inputDirection * MoveSpeed;
		MoveAndSlide();
		UpdateAnimationParameters(inputDirection);
		PickNewState();
	}

	private void UpdateAnimationParameters(Vector2 moveInput)
	{
		if (moveInput == Vector2.Zero) return;

		animationTree.Set("parameters/Idle/blend_position", moveInput);
		animationTree.Set("parameters/Walk/blend_position", moveInput);
	}

	private void PickNewState() => stateMachine.Travel(Velocity == Vector2.Zero ? "Idle" : "Walk");
	
	private static Vector2 GetInputDirection()
	{
		return new Vector2(
			Input.GetActionStrength("ui_right") - Input.GetActionStrength("ui_left"),
			Input.GetActionStrength("ui_down") - Input.GetActionStrength("ui_up")
		).Normalized();
	}
}
  • Amon lmao now its sliding. This works though

    public override void _PhysicsProcess(double delta)
    	{
    		GlobalPosition = controller.GlobalPosition  * (float)delta;
    	}

    Thanks!

Velocity = inputDirection * MoveSpeed * delta

    Amon lmao now its sliding. This works though

    public override void _PhysicsProcess(double delta)
    	{
    		GlobalPosition = controller.GlobalPosition  * (float)delta;
    	}

    Thanks!

    Although this is better approach i suppose