Character body collisions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 5alidshammout

I want to make a Character body collide with rigid bodies but that isn’t working probably, I used this code that I found after the move_and_slide() method:

for col_idx in get_slide_collision_count():
	var col := get_slide_collision(col_idx)
	if col.get_collider() is RigidBody2D:
		col.get_collider().apply_central_impulse(-col.get_normal() * 0.3)
		col.get_collider().apply_impulse(-col.get_normal() * 0.01, col.get_position())

if it’s not possible to achieve perfect collisions with a character body, then what is the fastest way to transform a character body to a rigid body, with movement ability, of course?