Advertisement Jump to content
Sign in to follow this  
bmarci

Invalid internal pointers after startup

This topic is 1812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've been playing around with bullet and bumped into a problem.

The collision shapes cannot be deleted right after they are created.

 

Here are some samples;

 

First the init:

coll_config=new btDefaultCollisionConfiguration();
coll_dispatch=new btCollisionDispatcher(coll_config);
overlap_paircache=new btDbvtBroadphase();
solver=new btSequentialImpulseConstraintSolver;
world=new btDiscreteDynamicsWorld(coll_dispatch,overlap_paircache,solver,coll_config);

world->setGravity(btVector3(0,-9.81f,0));

pretty simple, from the basic samples.

 

And this is weird:

// Create the shape
btCollisionShape* shape=new btBoxShape(btVector3(1,1,1));
btVector3 inertia(0,0,0);
shape->calculateLocalInertia(5,inertia);
	
btTransform trans;
trans.setBasis(btMatrix3x3(1,0,0,0,1,0,0,0,1));
trans.setOrigin(btVector3(0,0,0));

btDefaultMotionState* mstate=new btDefaultMotionState(trans);
btRigidBody::btRigidBodyConstructionInfo ci(5,mstate,shape,inertia);
btRigidBody* body=new btRigidBody(ci);
world->addRigidBody(body);

// And remove!
btCollisionObject* obj=world->getCollisionObjectArray()[0];
delete body->getCollisionShape();
delete body->getMotionState();
delete body;
world->removeCollisionObject(obj);
delete obj;

The remove method is also from some basic sample.

But in this case the removeCollisionObject() references some uninitialized broadphase proxy pointer.

 

in btDbvtBroadphase::destroyProxy

The same happens with SimpleBroadphaseProxy.

 

the strange thing is, the whole thing works after the simulation is running for some time.

 

 

Did anybody have anything similar???

 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!