Not able to move spring block with character body2d

Godot Version

4.7 stable

Question

I have a spring block. The game has a hand as the main character that the player can control. I want the hand to interact with spring block and the spring block should have toing like motion. But right now, the hand couldn’t move the spring block, not even an inch. I have tried lot of configurations but nothing seems to be working.

The impulse is just to test the spring, and it is working, but hand is not able to move the spring block.

extends Node2D

@onready var block: RigidBody2D = $Block

func _input(event: InputEvent) -> void:
	if event is InputEventKey and event.pressed and event.keycode == KEY_SPACE:
		$Block.apply_central_impulse(Vector2(300, 0))

A CharacterBody2D won’t push a RigidBody2D on its own. move_and_slide stops the character against it and no force gets transferred, so the block sits there. That lines up with the impulse working while the hand does nothing.

You apply the push yourself after move_and_slide:

var push_force = 80.0

func _physics_process(delta):
	# after move_and_slide()
	for i in get_slide_collision_count():
		var c = get_slide_collision(i)
		if c.get_collider() is RigidBody2D:
			c.get_collider().apply_central_impulse(-c.get_normal() * push_force)

The collision normal points out of the block, so it gets reversed to push away from the hand. push_force is yours to tune against the block’s mass and how stiff the spring is.