In my space game I need interiors of ships to basically be like their own little local world - regardless of how the ship is flying, the player should be able to walk around inside and interact with the physics as though the ship was perfectly still.
To do this I'm assuming the best way is to have the interior existing as a separate physics world rather than trying to apply forces to all the objects to counteract ship motion (which would probably be extremely unstable, with jittering objects, etc.).
I'll have to "teleport" objects between the portals between these worlds of course (also translating the velocities to the new coordinate system), but my question is, what's the best way to implement multiple worlds like this?
Should I use collision masks, or multiple btDynamicsWorld instances?
Collision masks might be simpler and possibly faster, but they weren't designed for entirely separate worlds it seems, so maybe it would cause performance problems when you have multiple worlds overlapping the same space, separated only by collision masks.
Multiple connected physics worlds?
-
- Posts: 9
- Joined: Tue Feb 26, 2008 6:24 pm
- Location: California
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Multiple connected physics worlds?
It is probably best to keep the simulations totally separate, and manually implement the interaction between the worlds.
Do you have more details about the interaction between the interior local world and the exterior global world? Is it just the player, or do all interior physics objects of the local world interact with the global world?
Thanks,
Erwin
Do you have more details about the interaction between the interior local world and the exterior global world? Is it just the player, or do all interior physics objects of the local world interact with the global world?
Thanks,
Erwin
-
- Posts: 9
- Joined: Tue Feb 26, 2008 6:24 pm
- Location: California
Re: Multiple connected physics worlds?
For the most part only space ships will enter and exit the inner local world. It would be extremely unlikely for a car for example to be launched into outer space, although it would be good for consistency to handle all objects between the inner/outer border the same unless it reduces performance.
There will never be a huge number of physics objects loaded though, since objects will be loaded on demand when they come within a radius from the player, and unloaded when determined irrelevant.
There will never be a huge number of physics objects loaded though, since objects will be loaded on demand when they come within a radius from the player, and unloaded when determined irrelevant.