Restitution - Question

Hello all,

I am learning Box2D and I like it a lot. I have a problem with a simple object bouncing of the floor.
I understand that setting restitution to 1.0f will make the object bounce to the same height (is this assumption correct?). What happens to me is the object keeps bouncing higher and higher. I would like it to bounce to the height I dropped it from.

I created a static body (set as edge) around the screen. I set gravity to 0.f, 9.8f. I created a ball as dynamic body and density = 1.0f, friction=0.0f, restitution = 1.0f.

What is that I am missing here?

Any help would be appreciated.

Thanks.
9.8f should be -9.8f if you want downwards gravity. I don't know if 1.0f restitution will make the ball bounce to the same height, I think 1.0f means the object is perfectly elastic but gravity will still do its job. You may need to apply an impulse or force of some kind to keep the bounce height the same.
The gravity works ok. The ball bounces ok. But every time it bounces higher and higher. There are no forces applied. If I set restitution to lets say 0.9f then every bounce will be lower than the previous one. I just don't know what settings should be applied to make the ball bounce to the same height every time.

Any more suggestions?

Thanks
After more testing I found out a way to keep the ball bouncing to the same height (for a long time). I found out that if you have:

Gravity: +/- 9.8f The ball restitution should be: 0.9875f
Gravity: +- 15.0f The ball restitution should be: 0.9845f

The ball will bounce to approximately the same height but after a while it might drop just a little bit. I think this is the closest I can get the ball to jump to same height.
You cannot get a perfect rebound due to position correction when shapes overlap.

Original thread: https://box2d.org/forum/viewtopic.php?t=6790