Body_entered/exited are constantly firing

Godot Version

v4.2.1.stable.official [b09f793f5]


This chest scene is looking for the player. When the player stands, without moving, in the area of the chest, the signals body_entered and body_exited constantly fire. It enters and exits over and over. The only body is the player.

func _on_area_2d_body_entered(body):
	print("Entered ", body)

func _on_area_2d_body_exited(body):
	print("Exited ", body)

Any ideas on where I go from here?

*** edit ***
I found the reason why this was happening. I had my player’s area set to toggle on and off.
If you want to know why, when the player entered an item’s area with a full inventory, they wouldn’t pick up the item. If you make room in the inventory the item still wouldn’t be picked up because the entered signal already fired. This was my terrible solution. I’ll need to come up with a different one.
Thanks everyone that tried to help! And I’m sorry for my delayed response, life got in the way.

1 Like

This is a very interesting problem for sure, the only time I can recall an issue like this was with 3d areas and the sort.

Could you put a picture of the print log so that I could have a better idea of what’s going on?

That’s not right. Because you got something tripping the body_exited.
If the body is in fact in the area it should only be a single print. What else is causing the body to exit the area? Is the player changing z location? Is there a timer for anything? And, is there a function to free the queue and make another chest?

Is either your area or player scaled non-uniformly?

@gertkeno @fallenknight001 @gionggone Thanks trying to help!

1 Like