Hi all,
I would like to have a physics world with: a ground (static), a box and a bouncing ball.
In order to have a bouncing ball, I need to set a restitution coefficient > 0.0f on my three bodies. Indeed, the restitution coefficient are multiply together to obtain a combined restitution (see btManifoldResult::calculateCombinedRestitution).
Problem: when my box fall on the ground, it bounces. So, I have a 'bouncing box' but I don't want it.
If I set the restitution to 0.0 for my box: my bouncing ball doesn't work anymore when it collide with the box.
How can I solve this problem ?
Thank you in advance.
Restitution coefficient
-
- Posts: 13
- Joined: Fri Apr 05, 2013 6:19 am
- Location: Pittsburgh, PA
Re: Restitution coefficient
This is a bit old, but in case you're still checking for an answer, the SDK manual mentions under advanced topics that you can have per-triangle friction/restitution values. It's recommended to check Demos/ConcaveDemo to see an example of using a CF_CUSTOM_MATERIAL_CALLBACK. Alternatively, they recommend looking into btMultimaterialTriangleMeshShape (demoed in Demos/MultiMaterialDemo).
This sounds to me like it would accomplish what you'd want; you could have an overall restitution value for the block of, perhaps, > 0.0 (to allow for bouncing), and then "override" the restitution for the base to prevent it from bouncing. Or you could do it the opposite way. This method would accomplish what you want it to do (presumably), but it also feels a slight bit hackish, if you were to ask me (as in, it works here because it's a special case we planned for, not because of an overall rule). Admittedly, I'm still fully grasping restitution values myself, so perhaps someone more versed could give you a better pointer.
This sounds to me like it would accomplish what you'd want; you could have an overall restitution value for the block of, perhaps, > 0.0 (to allow for bouncing), and then "override" the restitution for the base to prevent it from bouncing. Or you could do it the opposite way. This method would accomplish what you want it to do (presumably), but it also feels a slight bit hackish, if you were to ask me (as in, it works here because it's a special case we planned for, not because of an overall rule). Admittedly, I'm still fully grasping restitution values myself, so perhaps someone more versed could give you a better pointer.