# How could I make a ball bounce when on a specific material?

I am attempting to make a ball bounce consistently when on a specific material. This is made in the rolling ball example project, so the player is controlling the ball. I simply want to be able to make the ball bounce continuously when it hits the ground, but I do not want it to bounce off of other objects such as walls or placed props. How would I go about this? Thanks.

Create yourself a physics material (or use one of the ones that comes with the engine.) Assign it to the material you use on the floor. When you collide with the floor, check which physics material it is and respond appropriately. This can probably be done inside the physics material itself, but I’ve not played about with them much.

First you need to create and set physics materials for your materials, then you need to use the hit result(Hit Phys Mat) of Hit Event or a line trace to the ground and get the physics mat of the hit location. You can then use that surface type output and change the behavior of the ball with Switch on EPhysicalSurface enum. Or just create and set physical materials and set the desired Restitution value inside the physical material.

This is the simplest way that I could figure out, however, the ball bounce height is not always consistent. This height depends on how high the ball previously was, so falling off of a small ledge will cause the ball to have very short bounces and falling off of a high ledge will cause the ball to have rather large bounces. Is there a way to regulate the height of the bounce while still just using a physics material?

Hey guys, I would love a technical explanation of how you setup the BP for the surface. I’m making a trampoline and I started just applying an impulse to any actor that collides with a box component, but that’s pretty much a hack. I’d like the surface to react differently depending on the colliding actors phys_mat properties.

I’m currently getting the physical material of the colliding actor, then grabbing it’s restitution to multiply it with the trampoline’s fabric phys_mat - the result is then multiplied by the colliding actors density and fed into the impulse.

Is there a better way to do this? I assumed physical materials would respond physically accurate with any physics object without the need for an impulse.

Thanks!