Is there a way to get only the first collision with TileMap ?

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

When my player(kinematicBody2D) collide with a tile(TileMap) I need to only acknowledge the first collision until it collides with a different cell. how can I achieve this ?

:bust_in_silhouette: Reply From: Brinux

I’m making some logic leaps here, but what I think you need to look at is Collision Layers. Putting the things you want into layers so they will collide only with what they’re supposed to.

Once you get things into layers, you won’t need to fiddle with getting “the first” collision, it will only collide with what it should collide with.

Watch this excellent video on Collision Layers, makes it very easy.
Godot 3 - How to Use Collision Layers