How to set overlapping static bodies priority?

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

I have a TileMap and on top of it a StaticBody2D (Slippery) such that the top surface of both exactly overlap like this:

enter image description here

with the friction on the StaticBody2D set to 0 and friction of Tilemap set to 1

so How do I set the priority of the StaticBody2D higher than that of the TileMap such that any body on top of them only interacts with StaticBody2D but not Tilemap?

“why not just place StaticBody2D above TileMap?”

If I do that then it causes an elevated bump which stops any body from horizontally entering StaticBody2D

“why not hollow out that portion of the TileMap and place StaticBody2D in it?”

The StaticBody2D is generated during runtime and hence the player decides where it is placed making it difficult to modify the tilemap

I couldn’t find a solution related to collision priority. But I recreated your scenario and added an Area2D as a child of the StaticBody2D, which changes the friction of the body above it… Would you like me to post a complete answer about this?

Hut | 2023-01-16 13:19