# Is restitution the wrong value, to make bouncing objects?

I have been experimenting with Bullet. Specifically I was modifying the Hello World tutorial, to make the ball bouncing.

The first thing I noticed is, that I need to set both the restitution of the ball and the ground above 0 to make the ball bouncing.

For a simple setup, with two objects, this seems fine. However, for larger simulations I fell like, restitution is the wrong way, to make bouncy objects. Here are my reasons:

# Reason 1

Consider three objects: ball, box and ground. ground is just some plane. box is a box, which is not supposed to be very bouncy, thus its restitution is near or equals zero. ball is supposed to be bouncy, so I give it a restitution of 0.5.

If now the ball collides with the ground, it only actually bounces, if the ground also has a restitution higher than 0, so let's give it a restitution of 1. So our ball is bouncy as expected, when colliding with the ground.

When it collides with box it won't bounce, because the box has a restitution of 0. If we give box a higher restitution, the ball will bounce from it. But now we have a different problem. If the box collides with the ground, it will bounce off, but it isn't supposed to.

I see no way, with restitution only, to make this scenario work.

# Reason 2

Restitution describes the amount of energy, that remains as impulse after a collision. The rest of the energy goes into deforming the colliding bodies and other side effects.

If we now look at a typical bouncy object, like a rubber ball, we see that they are easily deformable (compared to less bouncy objects). When the rubber ball collides with something, it takes up energy from the collision, by being deformed and then goes back into its original form, thus releasing the energy taken up during the collision and bouncing back off.

# The solution (?)

Reason 2 suggests, that a bouncy ball (like a rubber ball) shouldn't have a restitution close to 1, but rather be elastic (thus being deformed and then going back to its original form), to model bouncy objects as expected.

The way to model this in Bullet, would be a soft-body and I think it would be the way to go, in such a scenario.

# The actual question

The text above looks more like an answer than a question, so here's the question I'm trying to ask:

I'm really unsure, whether this is right. Are soft-bodies really the better way for bouncy stuff or am I just mistaking the principle of restitution?

You're mistaking restitution. Or more specifically, it depends upon Bullet's chosen restitution implementation.

Ideally you would be able to define [ball, plane].restitution as 0.9 and [box, plane].restitution as 0.1, for example.

The total coefficient of restitution, in real life, is almost always >0.0 and <1.0.

Thus, when generating your restitution from two separate object materials, depending on the method*, ensure that your coefficients are between 0.0 and 0.5.

*The example above assumes that the two materials' restitutions are added together. I am not sure about whether Bullet adds them together, multiplies them or performs some form of min/max.

Further investigation:

1. Looking at bullet's constraint solver you can see that it gets the contact manifold
2. Once it has the manifold it gets a specific contact point
3. Once it has the contact point it requests its "m_combinedRestitution"

However, I do not have the time right now to download the source and investigate where the m_combinedRestitution is set. If you were to investigate, I'd look into the NarrowPhaseCollision section of Bullet.

• AFAIK Bullet multiplies the restitutions of the bodies. Two colliding objects, of which one has restitution = 0.0, will not bounce, regardless of the other restitution. (It may also be some other kind of magic, like min) – Kritzefitz Sep 17 '15 at 15:55
• Right, so using that information then you can determine a target desired restitution per collision and then calculate their individual CoR from that. Going soft-body just for bouncing is not an ideal solution if performance is even the slightest desire. – Vikram Saran Sep 18 '15 at 1:04
• You can also look into writing your own combined restitution function, apparently: bulletphysics.org/Bullet/phpBB3/… – Vikram Saran Sep 18 '15 at 1:05
• Try this: Ground doesn't absorb energy, so 0.9 (hard linoleum with concrete underneath) or so. Box is very non-bouncy, so 0.01 or so (cardboard crumples). Ball is rather bouncy, so 0.9 (Pumped up leather basketball at max pressure)... Then you get: [Box, Ground] = 0.009, [Ball, Ground] = ~0.81 Numbers based on Wikipedia: (For a hard linoleum floor with concrete underneath, a leather basketball has a COR around 0.81-0.85) – Vikram Saran Sep 21 '15 at 1:31
• In summary, use restitution as the expected amount of energy that the object will retain in kinetic form at the end of any collision. If you expect the Ground to not move, lose energy, etc... set its restitution to 1.0! – Vikram Saran Sep 21 '15 at 7:23