# Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Posted: Tue Feb 28, 2012 9:37 am

Joined: Sun Nov 15, 2009 6:28 am
Posts: 11
As I understand it, coefficient of restitution and coefficient of friction are defined w.r.t pairs of surfaces. However, Bullet lets users define coefficients of friction per rigid body. How is the resultant coefficient of restitution (or for that matter, the coefficient of friction) between two objects calculated? Is it perhaps the product of the individual coefficients?

The questions above relate to the problem I am having regarding the bounciness of a ball (collision shape: btSphereShape) on a static plane (collision shape: btBvhTriangleMeshShape). 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. I would like the ball to stick to the surface of the plane instead.

Top

 Posted: Tue Feb 28, 2012 6:44 pm

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
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
Code:
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;
}

//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.
Code:
m_dynamicsWorld->getSolverInfo().m_splitImpulse = true;

Hope this helps,
Erwin

Top

 Posted: Wed Feb 29, 2012 1:40 am

Joined: Sun Nov 15, 2009 6:28 am
Posts: 11
Erwin, thanks for responding. Yes, that does help clarify things. Thanks a ton!

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC

#### Who is online

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

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

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities