However when I now try to add support for Softbodies I'm stuck at it just crashing as soon as I add the softbody to the 'world'.
I've tried to look around at the examples and such, and I tried to make it as easy as possible, right now I'm using the mesh from one of the bunny samples, I simply want to load it in (I'm serializing out again, so as of right now I do not worry about getting the simulation visualized).
My current code is like this:
Code: Select all
#include <btBulletDynamicsCommon.h>
#include <btBulletCollisionCommon.h>
#include <BulletSoftBody\btSoftBody.h>
#include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h"
#include "BulletSoftBody/btSoftBodyHelpers.h"
#include "BulletSoftBody/btSoftRigidDynamicsWorld.h"
#include "Demos\GimpactTestDemo\BunnyMesh.h"
btDiscreteDynamicsWorld* dynamicsWorld;
broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
solver = new btSequentialImpulseConstraintSolver;
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
dynamicsWorld->setGravity(btVector3(0,-10,0));
//Add softbody bunny
btSoftBody* psb = btSoftBodyHelpers::CreateFromTriMesh(((btSoftRigidDynamicsWorld*)dynamicsWorld)->getWorldInfo(), gVerticesBunny,&gIndicesBunny[0][0],BUNNY_NUM_TRIANGLES);
//It crashes when I run the following function:
((btSoftRigidDynamicsWorld*)dynamicsWorld)->addSoftBody(psb);