Cannot detect collision from behind?

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

Here is a link to an video record of the problem (if the gif don’t load)
As the title says, when moving my player towards a direction and then another character hit it by behind, the engine seems not detecting that collision.

I move the player with : move_and_slide and both my player and the other character are KinematicBoby type.
Here is the code for detecting the collision for my player :

# Some code to handle inputs
velocity = move_and_slide(velocity)
for index in get_slide_count() :
	collide_data = get_slide_collision(index)
	print( + " collided with " +

The problem is the same when using move_and_collide :
Here is its code :

collide_data = move_and_collide(computedVelocity * delta)
if collide_data :
	print( + " collided with " +
:bust_in_silhouette: Reply From: aXu_AP

get_slide_collision and move_and_collide return only collisions caused by object itself moving, not if somebody else moves into it. As kinematicbody doesn’t react to other objects unless it itself is moving, there’s no monitoring for or functions to get other colliding bodies.

The solution is to add area2d around player to react other bodies. Use body_entered signal or get_overlapping_areas() to check.

Another possible solution is to use rigidbody instead, and set mode to MODE_KINEMATIC, which behaves similiarly to kinematicbody. Rigidbody has body_entered signal. You, however, have to implement move_and_slide yourself.