My game has a number of planets and ships, all of which have their own interior ‘spaces’ that the players are teleported to when they board the object. Multiple players and objects can exist in their own interiors at the same time, so I need to simulate all of the spaces simultaneously, without having them interact with each other. Ideally, the physics engine should also know that bodies in different spaces should ignore each other.
Does unity support multiple ‘spaces’ within the same scene? As in, multiple units could exist at the same world coordinates, without colliding with each other? And with only the cameras that exist in that space rendering objects within its frustrum?
I have looked at using multiple collision layers to represent multiple spaces, but they seem to be capped at 30 layers. If unlimited collision layers were possible, this would solve my problem.
My current solution is to place all of the interior spaces at (0, 0, 0) , and then separate them from each other by spreading them out along the z-layer so that entities in different interior spaces cannot collide with each other. I also place the Sun at (0, 0, 0), and make it surround interior space. The Sun is bigger than the maximum number of interiors * the max width of an interior. That way, objects in world space cannot interact with objects in interior space.
Is there a simpler, more elegant solution to having multiple ‘pocket dimensions?’ Carving off a chunk of world space to place the interiors seems like a bit of a hack.