I use Ogre as my graphics engine, and had been using OgreBullet as a wrapper. However, a few days back I decided to write my own 'thin' wrapper because OgreBullet tried to encapsulate the entirety of Bullet (it had RigidBody and DynamicsWorld classes), but in quite an ugly way. I wanted to just have a thin layer connecting Ogre and Bullet (basically updating Ogre graphics, and sending mesh information to Bullet), and use Bullet more directly.
Right now I'm working with Windows on my laptop because my desktop (which runs Linux) monitor isn't working, and I never got around to fixing it.
On my laptop, I had an older version of Bullet (2.69), and started writing the wrapper and a little test application to test it, and it works. Today, I tried to upgrade to the new one (2.73), and I get an access violation error which traces down to line 267 of btdbvtbroadphase.cpp in btDbvtBroadphase::setAabb, at "if(proxy->stage==STAGECOUNT)". It seems that the 'proxy' pointer is invalid. This happens when I step the simulation. I might be doing something wrong, but it worked with 2.69.
I remember I had a similar error before long back, but I forgot how I fixed it.
The Bullet initialisation looks like this:-
Code: Select all
mBroadphase = new btAxisSweep3(btVector3(-10000,-10000,-10000), btVector3(10000,10000,10000), 1024); mCollisionConfig = new btDefaultCollisionConfiguration(); mDispatcher = new btCollisionDispatcher(mCollisionConfig); mSolver = new btSequentialImpulseConstraintSolver(); Globals::phyWorld = new btDiscreteDynamicsWorld(mDispatcher, mBroadphase, mSolver, mCollisionConfig); Globals::phyWorld->setGravity(btVector3(0,-9.8,0));
Code: Select all
//Create shape. mShape = new btSphereShape(0.5); //Calculate inertia. btScalar mass = 5; btVector3 inertia; mShape->calculateLocalInertia(mass, inertia); //Create BtOgre MotionState (connects Ogre and Bullet). BtOgre::RigidBodyState *state = new BtOgre::RigidBodyState(btTransform(BtOgre::Convert::toBullet(rot), BtOgre::Convert::toBullet(pos)), mNode); //Create the Body (at last!). mBody = new btRigidBody(mass, state, mShape, inertia); mBody->setFriction(1000); Globals::phyWorld->addRigidBody(mBody);
Thanks for the help!