[SOLVED] Multiple worlds and a character controller?
Posted: Wed Dec 28, 2016 9:00 am
I have multiple worlds and wish to use a character controller http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=5684. I want the feature of the character controller changing worlds.
I setup each world with following code:
The problem is the character controller requires a btBroadphaseInterface.
If all the worlds share a single instance of a btBroadphaseInterface the app crashes.
Do I have to include a character controller for each world and direct the movement to my "current" character controller or can I share a single instance of a btBroadphaseInterface and more?
Thank you.
I setup each world with following code:
Code: Select all
// Initialize Bullet. This strictly follows http://bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World,
// Build the broadphase
btBroadphaseInterface* broadphase = new btDbvtBroadphase();
// Set up the collision configuration and dispatcher
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
// The actual physics solver
btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
// The world.
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
dynamicsWorld->setGravity(btVector3(0,-9.81f,0));
dynamicsWorld->setDebugDrawer(&mydebugdrawer);
If all the worlds share a single instance of a btBroadphaseInterface the app crashes.
Do I have to include a character controller for each world and direct the movement to my "current" character controller or can I share a single instance of a btBroadphaseInterface and more?
Thank you.