Multiple Seperate Physics Environments

So i’m fairly new to Unity and i’ve been planning to use it to create a fairly standard turn based rpg. The data structure of the rpg will be seperated into levels (which are seperated by loading screens) and rooms (which are seperated by doors or magical flying pidgeons or whatever the heck.)

The basic principle of a room is that it is completely in isolation from any other rooms in the current level. This means that while it is active physics in other rooms doesn’t run, rendering in other rooms doesn’t happen, and updates in other rooms dont play. Also certain things such as gravity may work different in one room from the next.

How do i seperate the physics worlds of two rooms discretely and easily?

I can think of some hacky solutions that involve mass enabling / disabling of physics components for active / non active rooms. But then what if i was to have two specific rooms that need updating? (maybe an important NPC is doing a job in another room or there are 2 players in different rooms.)

I could place the rooms at different physical locations in the same physics world so they don’t interfere with each other (which may not even work if some rooms have a wide range of effect on their physics objects.) And really this seems like another nasty hack. In principle each room shouldn’t need to share anything and this means each room in a level needs to have the same gravity.

Please someone tell me there is some kind of way of properly seperating the two that doesn’t feel too hacky

Why is this a ‘hacky’ solution? It seems like exactly what needs to happen. You asking for physics to stop processing for a specific room when the player is not in it, so just make some static methods than cleanly sleep all of the rigidbodies in a given volume when you exit the volume (or whatever conditions you want).

Honestly i’m probably going to end up using something like this if theres no nice alternative. But the problem with this is each room essentially is part of the same ‘space’ in the physics engine. Which means that care needs to be taken that objects in one room are in a different physical location than objects in another, long range effectors may affect things they shouldn’t if two rooms are active. And also gravity and any phsyics engine ‘configs’ must be the same for each room in a level.

not to mention AI wierdness that might happen from ‘seeing’ collidables that shouldn’t exist to the AI when querying the physics engine