Restitution value does not get applied for container shape with convex hull child

Please see the following example:

The bunny bounces around quite ab it, this is the desired result.

When using a shape container with a convex hull child, the high restitution value does not seem to be applied, the bouncing is gone:

This only applies for convex hull and mesh shapes. When I use a primitive box shape the bouncing happens either way:

A solution is to set the material explicitely for every shape:

const shapeContainer = new BABYLON.PhysicsShapeContainer(scene)
shapeContainer.material = physicsMaterial
const shape = new BABYLON.PhysicsShapeConvexHull(bunny, scene)
shape.material = physicsMaterial

This might be due to the code for the physics aggregate, handling different shapes differently


cc @Cedric and @carolhmj

I tried without the aggregate and the same behavior happens, so I don’t think it’s on that part: Physics V2 Simple scene with Aggregate | Babylon.js Playground (
There might be some difference in how the physics material is defined for container shapes depending on what shapes are contained? cc @eoin

To me, this looks like the intended behavior. You may want different materials on different shapes in a container on the same rigidbody. An example could be an axe. You may want the handle to be bouncy with high restitution, but the head part of the axe not so much with low restitution and high friction.

I don’t think there’s a smarter or more intuitive way of doing this than simply setting the material on individual shapes. A container is just a container after all, letting the engine know where every shape should be in relation to each other/the container

Yeah but even if so, it should be consistent between different shapes. Currently the material for e.g. box shapes gets applied automatically, for convex hull shapes it’s not.

Ahh yeah. I see

1 Like