i'm trying to detect when the Player is on the ground in my 2D sidescroller but i'm having a hard time.
I tried to add a sensor fixture to the bottom of the player's body and the ContactAdapter "sensed" it right. The problem is I never know when the contact ends

I also tried without the sensor:
listening for "persisted" and "end" contacts, I created a Rectangle in the bottom of the player and tested if the contact.getPoint() is contained in this Rectangle this way (pseudocode)
(player is a Rect)
contacts = Set
footsRect = Rectangle(PLAYER_WIDTH * 0.9, 0.1)
on persisted
if player body is involved
- footsRect.translate(playerBody.X, playerBody.Y - playerBody.HEIGHT + footsRect.HEIGHT / 2)
- if contact point contained in rect
-- add the other body to the set
on end
if player body is involved
- remove the other body from the set (no test with the rectangle)
player_is_on_ground = contacts.size() > 0
I also tried with a Map<Body, Integer> to count the contacts and only remove them when Integer <= 0 but failed...
suggestions? ;(;(
EDIT:
i tried this method also (basically the same as mine, using id instead of Body):
viewtopic.php?t=24
seems like begin is called more times than end and with different ids sometimes. it's very noticeable just by printing the set size on every contact