Inacurrate collisions for CreateCapsule + Ammo CapsuleImpostor

When using MeshBuilder.CreateCapsule and CapsuleImpostor, if the total height is set too high (I think over twice the sphere diameter), collisions will be inaccurate. Using Compound impostors seems good for all heights

Height of Capsules: 2 (Good collisions):

Playground: https://www.babylonjs-playground.com/#3EDS3A#489

Height of Capsules: 4 (Inaccurate collisions, bottom and top spheres intersect other impostors):

Playground: https://www.babylonjs-playground.com/#3EDS3A#490

Was wondering if anyone had run into this before? Thank you for your help!

For your reference, the height of the CreateCapsule is defined in:

const capsule = BABYLON.Mesh.CreateCapsule('', {
    subdivisions: 2,
    tessellation: 16,
    height: 2,
    radius: 0.5,
    capSubdivisions: 6
}, scene);

Pinging @Cedric

1 Like

Hi @gbz

Yep, looks like we have a problem here. I think the issue is when computing the impostor size from the source mesh…investigating…

1 Like

Thank you so much for your time and help :slight_smile:

1 Like

PR Fix capsule impostor size computation for ammojs by CedricGuillemet · Pull Request #9745 · BabylonJS/Babylon.js · GitHub

1 Like