I tried searching for any information on this topic, but there is not much out there. My question is: how to detect if the player is outside, in the world, or inside, in the interior? My first idea was a raycast to check the collision above the player controller’s head, which proved useless really quickly.
Of course, there is an Area3D node, but I don’t know if that would be too expensive resource-wise, and if that is the best solution, should I create meshes for CollisionShape3Ds out of the interiors and then use them for Area3D’s shapes, or how to achieve this?
I don’t know much about 3D, but when it comes to 2D, Area2D is the way to go. The BodyEntered/BodyExited and AreaEntered/AreaExited are the signals I use
It really depends on how your maps are built. Both. areas and raycasts could work. You don’t need full volume areas. You can put areas on doorways, mark each side of a doorwau as being outside or inside. When player passes through the door - determine if they’re on the inside or outside side.
Why would you consider that “polluting”? Most 3D maps will be full of colliders anyway. If you have doors that open/close they’ll also need interaction colliders anyway.
If all your interiors have ceilings and exteriors don’t have them, you can use an upward facing raycast. But that too will need colliders on every ceiling.
Maybe show your typical map for a more specific suggestion.
You can use a single area per passage. Orient it in such a way that its specific basis vector (say -z) is always pointing “out”. When the player exits the area, take a direction vector from the collider to the player, normalize it and take its dot product with area’s “out” vector. If the dot product is greater than zero, the player is on the “out” side.