I am trying to figure out collisions of dynamic objects with static objects- which in my case produce no response. Given a static "ground" box I have some dynamic objects (cubes) falling down on it (-9.8 gravity). These dynamic objects have damping and restitution defined (.3 and .7) and bounce off each other when colliding- however when colliding with the static ground these dynamic cubes just stop- no impact response (bouncing off) whatsoever. Why is that? How do I fix this behavior?
I am using bullet 2.75 RC 7 with Ogre3D- Here's how I create the static ground object:
Code: Select all
// build ground plane
Ogre::ManualObject* ge = createCube(50, 2, 10, "floor", "Ogre/DepthShadowmap/Receiver/RockWall");
Ogre::SceneNode* node = Globals::mSceneMgr->getRootSceneNode()->createChildSceneNode("groundNode");
node->setPosition(0, -25, 0);
node->attachObject((Ogre::MovableObject*)ge);
// Create the ground shape
btCollisionShape* sp = new btBoxShape(btVector3(50/2,2/2,10/2));
// Create MotionState (no need for BtOgre here, you can use it if you want to though)
btTransform gt;
gt.setIdentity();
gt.setOrigin(btVector3(0,-25,0));
btDefaultMotionState* groundState = new btDefaultMotionState(gt);
// Create the Body
btRigidBody* gb = new btRigidBody(0.f, groundState, sp, btVector3(0,0,0));
gb->setCollisionFlags(gb->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT);
gb->setDamping(.1, .1);
gb->setRestitution(.9);
Globals::phyWorld->addRigidBody(gb);
Code: Select all
Globals::phyWorld->performDiscreteCollisionDetection();
Globals::phyWorld->stepSimulation(evt.timeSinceLastFrame, 5);
Thanks
/Chris