You are trying to add PhysicsImposter to root of .gltf-file. This won’t work, you have to add collision_shape in i.e. Blender (like: How to use MeshImpostor with blender imported glb? - #5 by paulbonneau), and might have to switch to .babylon-file (simply use sandbox to export from gltf). And then you can iterate through actual meshes like this:
for(const mesh of res.meshes) {
if(!mesh.name.includes('__root__')) mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.CustomImpostor, { mass: 0, restitution: 100}, scene);
}
Alternatively you can create a collision-Mesh in Blender, then you don’t have add Imposter to every mesh.
Additionally CustomImposter
might require AmmoJSPlugin
.