[3.1.1] KinematicBody2D move_and_collide with RigidBody2D not working

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

Hello! I have a KinematicBody2D and a RigidBody2D. I need to check if the kinematicbody collides with the rigidbody but it is not working and I don’t know why. The collision occurs but the code does not print anything.

Here is the code in the KinematicBody:

Here is the KinematicBody2D node parameters:
KinematicBody2D node parameters

Here is the KinematicBody2D collision shape:
KinematicBody2D collision shape

Here is the RigidBody2D node parameters:

Here is the RigidBody2D collision shape:

I tested another way to check the collision using RigidBody2D body_entered signal and it is working fine, but I need to check the kinematicbody2d collision with the rigidbody using move_and_collide because I need to know if both collide in advance.

Here is the code:
RigidBody2D signal code

I have something very similar but even the body entered signal won’t work.
Everything work if I just change one of the two bodies to StaticBody2D.
Did you find a workaround?

LouisSimon22 | 2019-10-27 16:22

The problem I had was not related to the code I posted here. In fact, there was another part of the code that was causing the problem. The people at Discord helped me to solve this.

equus | 2019-10-27 20:16

:bust_in_silhouette: Reply From: equus

There was another code that was responsible for the problem.