noob trying to figure out static object collisions

Post Reply
Idefix
Posts: 2
Joined: Sun Aug 30, 2009 12:45 am

noob trying to figure out static object collisions

Post by Idefix »

Hi -

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);
And here is the simulation update:

Code: Select all

Globals::phyWorld->performDiscreteCollisionDetection();
Globals::phyWorld->stepSimulation(evt.timeSinceLastFrame, 5);
How can I use damping, restitution and the other physical properties with static objects?

Thanks
/Chris
garvek
Posts: 6
Joined: Tue Aug 25, 2009 10:26 pm

Re: noob trying to figure out static object collisions

Post by garvek »

Hello,

from what I saw in my experimentations there is no bouncing unless the object is very light or is falling from very high, perhaps it is your issue ?
Idefix
Posts: 2
Joined: Sun Aug 30, 2009 12:45 am

Re: noob trying to figure out static object collisions

Post by Idefix »

My test objects are 2.5 x 2.5 x 0.5 units with 1.0 mass and are falling from 90 units height- should qualify as very high I guess? The respective damping and restitution parameters should allow for that bouncing response- is there something special about static objects in context of material properties and response? Or am I completely misunderstanding things here and not doing things the right way?

Thanks
/Chris
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway
Contact:

Re: noob trying to figure out static object collisions

Post by ola »

You need to set the restitution values for the static objects too. The default value is 0 which means no bounce.

When colliding, the restitution values for the two colliding bodies is combined by multiplication, so if one of them is zero, the result is zero, no matter what the other value is.
Post Reply