Essentially, it seems that after the cube in HelloWorld "settles", ie. has a velocity of 0, it will no longer react to gravity or impulses applied to it.
I essentially modified the simulation stepping code to run for more steps, and after 300 steps, which is when the cube has no longer been moving for quite a few steps, I apply an impulse. However, when I do this the position remains unchanged. Similarly, if I change the center of mass transform to put it above the floor, it remains stuck there; gravity doesn't do anything.
I'm relatively new to Bullet although already have a good part of an application written which uses Ogre with Bullet. However, I just ran into this problem and would appreciate any insights!
Code: Select all
// Modified chunk of AppHelloWorld.cpp
for (i=0;i<500;i++)
{
dynamicsWorld->stepSimulation(1.f/60.f,10);
if (i == 300) {
theDynamicRigidBody->applyCentralForce(btVector3(0, 100, 0));
}
printf("\n%d. step frame!!!\n", i);
//print positions of all objects
for (int j=dynamicsWorld->getNumCollisionObjects()-1; j>=0 ;j--)
{
btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[j];
btRigidBody* body = btRigidBody::upcast(obj);
if (body && body->getMotionState())
{
btTransform trans;
body->getMotionState()->getWorldTransform(trans);
printf("world pos = %f,%f,%f\n",float(trans.getOrigin().getX()),float(trans.getOrigin().getY()),float(trans.getOrigin().getZ()));
}
}
}