# How to make a ball bounce on a solid floor?

I noticed, that the sphere with physical restriction of 0.8f doesn’t bounce on a solid box with default restriction of 0.0f. Why does it not work?

You mean restitution? probably the box needs a non zero value as well. I experimented with it abit a while ago, but you can end up flying miles into the air depending on the downward acceleration on impact, so i used my own method to make me bounce the same height each time regardless of height fallen (but this was for my use case, but you should be able to adapt it if needed)

[java] private boolean collided = false;
private long currentTime = System.currentTimeMillis();
private Vector3f bounce = new Vector3f(0, 300f, 0);

``````public void collision(PhysicsCollisionEvent event) {
if ((some collision between ball and floor)) {
if ((System.currentTimeMillis() - currentTime) &lt; 150) { // prevent this being called more than once for each bounce
return;
}

currentTime = System.currentTimeMillis();
collided = true;
}
``````

}

``````public void prePhysicsTick(float tpf) {
if (collided) {
rigidBodyControl.clearForces();
rigidBodyControl.setLinearVelocity(rigidBodyControl.getLinearVelocity().clone().setY(0));
rigidBodyControl.applyImpulse(bounce.mult(tpf), Vector3f.ZERO);
collided = false;
}
}[/java]``````

Yes, i meant restitution. You are right, the solid floor (box) also needs a non zero restitution! But why?

I realy don’t understand why the bounce effect does not work on non compressible objekt, since the object of falling is a rubber ball. In real life it is possible to bounce a rubber ball on any solid non compressible objekt. Is there a way to simulate this scenario without making the box bouncing itslef?

In real world, it would require the floor to have an infinite mass in order to not bounce at all. If you would give it a very very high mass, the bounce effect might not be observable. I guess the library forbids this effect, because it would no longer be able to solve impulse and energy equations. But it’s just a blind guess.