KinematicBody2D and KinematicBody2d collision is not working correctly.

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

So basically this is me making a player scene and making two players from that scene.

This causes the physics collision between players to sometimes have one player detect the other or both players detect each other.

There was no consistency. How to fix.

:bust_in_silhouette: Reply From: zex

Answering my own question b/c I think it will be helpful. Also created it to be easier to search up as I answered it in another thread where I accidentally found the solution.

Link to thread: https://forum.godotengine.org/8923/kinematic2d-collision-detection-not-working-in-some-cases

Solution simple: Lower Collision margin in inspector for KinematicBody2D.

Solution from thread:

Thank you. Your Solution with collision margin helped me solve different problem.

I had a problem with two players, both KinematicBody2D colliding and not handling the physics event properly.

Where sometimes it one would detect the other or other times both detected each other.

By lowering the collision margin in the inspector window of the KinematicsBody2D I was able to fix the problem. I made it from 0.08 to 0.01.

Then only one of the two bodies was detecting the other. Namely the one which started it.

*Only basic testing was done so do your own tests on this as well.