How to check if the 3D areas are inside each other

Godot Version

v4.5.stable.official

Question

I need a script that checks if one area is inside the other even if they never touch each others borders. I have scenario where one area teleports in to another one and I don’t know how to detect when that happens.

Does anyone know how to do this please?

Areas have a area_entered signal for detecting other areas, as well as the function get_overlapping_areas

Yes, but those activate only when the borders of the areas are actively crossing each other. I wanted to know if there is a way to detect if let’s say really small area 3D appears inside a really big area 3D without ever touching each others borders.

the area_entered signal and get_overlapping_areas would detect a smaller area full enclosed in itself, even if suddenly appearing, it is not based on crossing borders.

It doesn’t seem so. I have tested it before and even with “print(detection_area.get_overlapping_areas())”
but when the smaller area is fully enclosed in a big one this just prints out empty array.
It only prints out the area when the borders are crossing.

Can you show how your scene is set up?

Sure


The purple area leading from the camera is the big area. And the t-posing dude has the small area on him, he also has the script with “print(detection_area.get_overlapping_areas())”.


Here I am in the position where borders of the two areas are crossing and as you can see the area is printing out correctly in the console.


But here the dude with the small area is right in front of me and still inside the big area but the array is printing out as empty.

Would using a VisibleOnScreenNotifier work better? Seems more accurate to what you are trying do

1 Like

Yea you are right.
I previously avoided this solution because I assumed it would have some issues I wanted to avoid but now I see that it is working ok.
Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.