Restitution and friction per collision shape

dans
Posts: 8
Joined: Tue Sep 18, 2007 6:56 am

Restitution and friction per collision shape

Post by dans »

Ive written code to add per shape restitution and friction, though that I would sumbit for consideration to add to the main trunk (Would save us some merging in the future ;-). I have attached the effected files along with this post (did this work with 2.71)

It does change the API in that btRigidBody::m_friction and m_restitution now become obsolete and are hence those and their accessors have been removed.

Cheers
You do not have the required permissions to view the files attached to this post.
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: Restitution and friction per collision shape

Post by mickey »

hmm, just wondering, why would the restitution and friction be on the shapes and removed from the bodies?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Restitution and friction per collision shape

Post by Erwin Coumans »

It would be good to have per-shape friction and restitution materials, but it seems we only need this for btCompoundShape isn't it?

For single shapes, we just have the current per-body material settings, and for triangle meshes there is already btMultimaterialTriangleMeshShape.h.

So a new btMultimaterialCompoundShape is preferred. Do you consider implementing this, or shall we add it as a feature request in Google Issue tracker?
Thanks a lot,
Erwin
dans
Posts: 8
Joined: Tue Sep 18, 2007 6:56 am

Re: Restitution and friction per collision shape

Post by dans »

Mickey, Ultimately I did it this way to avoid the check for btCompoundShape when calculating combinedRestitution/Friction. This format handles every combination compound or single shape without performing that check. This makes btRigidBody::setFriction/Restitution unnecessary. To maintain btRigidBody::setFriction etc one could iterate all shapes and set shape params from input values, but this would be fairly pointless in using multimaterial compound shapes as the entire set ends up with the same parameters. Erwin does addresses this with btMultimaterialCompoundShape.

Erwin, As it is the preferred method I am happy to implement btMultimaterialCompoundShape (has to be on my own time not my works :?) I will submit for review when it is done.
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: Restitution and friction per collision shape

Post by mickey »

Hi Dans

Thanks for the info!
natepak
Posts: 3
Joined: Tue Oct 13, 2009 5:05 pm

Re: Restitution and friction per collision shape

Post by natepak »

Has progress been made on this front? Collision shapes with friction and restitution would be very useful.