Code: Select all
dynamicsWorld->stepSimulation(1.0 / FPS);
dynamicsWorld->removeRigidBody(fallRigidBody);
delete fallShape;
fallShape = new btConvexHullShape(&vertices[0], vertices.size(), sizeof(btScalar) * 3);
btShapeHull* hull = new btShapeHull(fallShape);
btScalar margin = 0.001;// fallShape->getMargin();
hull->buildHull(margin);
vector<btScalar> vertDec;
//filling in vertDec
delete fallShape;
delete hull;
fallShape = new btConvexHullShape(&vertDec[0], vertDec.size()/3, sizeof(btScalar) * 3);
fallRigidBody->setCollisionShape(fallShape);
btScalar mass = 1;
btVector3 fallInertia(0, 0, 0);
fallShape->calculateLocalInertia(mass, fallInertia);
fallRigidBody->setMassProps(1, fallInertia);
dynamicsWorld->addRigidBody(fallRigidBody);
I would expect it to launch itself into air a bit and roll around, I would like it to have much more interesting movement. I tried setting different friction/rolling friction/restitution values, but neither worked well. I even tried to push the rigid body upward on every push-up by the ground, but it either didn't do anything or launched it into furious rotating spasms somewhere far away.
What am I doing wrong? Is something like this possible to do with bullet? I don't really want to write my own physics engine for this small thing...