Physics Simulation Forum


All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Feb 28, 2012 6:44 pm 
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3971
Location: California, USA
The restitution/friction is approximate in the Bullet library, but you can make some changes that improves it:
balajeerc wrote:
How is the resultant coefficient of restitution between two objects calculated?

It is computed in Bullet\src\BulletCollision\CollisionDispatch\btManifoldResult.cpp, see calculateCombinedFriction and calculateCombinedRestitution.

You can change the source code, or override it, by setting the
bool MyContactCallback(btManifoldPoint& cp,   const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
   cp.m_combinedFriction = 0.f;
   cp.m_combinedRestitution = 0.f;
   return true;

gContactAddedCallback = MyContactCallback;

//for each body that you want the callback, enable it:
body->setCollisionFlags(body->getCollisionFlags()| btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);

balajeerc wrote:
Even if I set the coefficient of restitution of both to 0.0, the ball does not stick to the plane as expected but bounces off of it.

Try enabling split impulse, it will prevent the added energy (velocity) from penetrations.
m_dynamicsWorld->getSolverInfo().m_splitImpulse = true;

Hope this helps,

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Google [Bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group