How do I detect collision in different parts?

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

I have a single RigidBody2D that I am using for a player, and a TileMap for the map around it. The player is a rectangle with two half circles on the short sides. I need to detect whether the player is touching the ground with it’s body, or with the semi-circles on the sides.
I tried using area2D nodes in the player to detect the specific collisions, but they can’t detect the TileMap. What can I do to differentiate the collisions?

(This would also be solved if the CollisionObject2D had a body_entered signal. It doesn’t have that for some reason??)

Why can’t the Area2Ds detect the Tilemap, is what I would be focusing on. They should be able to. https://forum.godotengine.org/71457/detect-contact-between-area2d-tilemap-collisions-enabled

k4gi | 2023-02-22 04:49

:bust_in_silhouette: Reply From: Andrea

you have to work in the integrate force function, which works with the phisic state of the object.

    func _integrate_forces(state):
     print(state.get_contact_local_position(p))
     print(state.get_contact_local_normal(p))