Hey everyone, I've just started integrating Bulet Physics with my game engine, and I started by creating a project based on the hello world demo. The code compiles and runs fine, I even got some gravity working.
However, now I'm transferring the initialisation code into the real project, and I've encountered some problems. When I try to use this line:
Code: Select all
btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
My program crashes. However, if I actually declare a btCollisionDispatcher, not a pointer, like:
Code: Select all
btCollisionDispatcher dispatcher(collisionConfiguration);
or
Code: Select all
btCollisionDispatcher dispatcher = btCollisionDispatcher(collisionConfiguration);
The program runs perfectly well, with no trace of the crash. However, I'd prefer to use the code with the pointer, as this is how the demo does it, and it seems tidier to me. The collisionConfiguration is initialised like this:
Code: Select all
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
I've checked the project setup, and all the libraries used in the test project are used in the game engine. The bullet includes are fine too. The only code I run before the bullet initialization code is a general Init() function, which sets up SDL, OpenGL and DevIL.
Does anyone have any ideas why this might be happening?
Thanks very much!