Area 2d has no overlaps n more

Godot Version

4.3

Question

Okay, so short question/statement is that i have a bunch of area2ds in my scene that need to pull data such as parents and types from each other based on whether they overlap or not. Up until a day ago, they registered overlaps fine and i could pull info from overlapping areas without incident. Now the overlaps array is showing empty in spite of the areas emitting overlap signals on entering and exiting each other and recognizing that they are in fact area 2ds.

To further complicate things, it seems as if collisionShape2ds have become more ā€œsuggestionsā€ about how something should collide or overlap, seeing as how i can futz with their radius all day n still need pixel perfect overlaps with their origins to have any effect. So that might have something to do with it too, dunno.

Ive made sure monitoring and monitored are true, collision layers and masks work properly, i use awaits after changing anything prior to checking for overlaps, tried refactoring as much as i could into physics process, even went so far as to make a ā€œtoggle collisionsā€ signal to try and kick start everythingā€¦ nada.

Oh and the final wrinkle, even when i can get it to work in editor (still, a day ago) still wont work on my phone anymore. Thats the most frustrating thing about this, everything worked fine until it didnā€™t.

Anyhoo, would love to know what im doing wrong, so any advice would be appreciated.

Thanks

I think we need to see some code.

The fact it was working, and now is not, suggests to me that you have introduced an issue somewhere preventing it from working. The fact that you find they are sometimes not responding as expected also suggests that too. What that might be I can only guess.

A CollisionShape2D does not have a signal for overlapping. How exactly are you checking that? (I add detected nodes to an array and loop through that to see what I need to react to, and remove them on exit. It sounds like you are doing that too.) They only fire on entry and exit. If you have introduced an await in your code, perhaps it has missed the event while it was waiting. I am sure you donā€™t need to wait for these things.

For me, it usually turns out to be the layers and masks, and the area2dā€™s group names. (I usually identify entering and exiting objects by the areas group.)

There was one thing that can mess up collision shapes I found out from experience. They do not like to be scaled in the transformation section. You need to make sure their scale is set to 1. You can scale them in the editor with the ā€˜scaleā€™ tool and dragging the points around. But do not use the normal ā€˜scaleā€™ setting in the transformation section. This can cause all sorts of issues.

Anyway, without specific code or examples, or even a more concrete question, I am not sure how I can be of any assistance. Sorry. I know it can be so frustrating when sometimes days are wasted it seems chasing your own tail on infuriating bugs. I find taking the time to set up a test scene with the most simplified example of what I am experiencing problems with, and testing out things there, is well worth the set-up time.

I hope you identify the issue soon. Please post anything we might be able to look at for you and see if we can help.

1 Like

There are many things it could be and with no code shown, thereā€™s not much to go on of. That said, I see you mentioned you are adding the areas to an array on entering and that the array is empty even when the signals work. Iā€™m going to make a guess here and assume you are checking for more than if you entered an area, before adding them into the array. Like being part of a group. I once changed the capitalization on one group and broke everything for days, had no Idea what happened and even thought the engine just bugged out on me.

Cant think on much else than that, sorry.

So i found the answer, nothing to do with code or settings. Somehow, not only did my areas parentsā€™ scale get set to 0, the positions of the collision shapes all got set to -4096. Once these issues were resolved everything worked as expected again.

Still not sure how these values got borked as i was working on something else at the time of screw up, but oh well.

1 Like