Hello, I’m the author of the Three.js Ammo examples. You have all what you need in the
createSoftVolume( bufferGeom, mass, pressure ) will create a soft body with the given BufferGeometry, the mass, and an internal air pressure value. A soft body is the type of body wich can deform, as opposed to the rigid bodies.
Of course you want to keep all the other functions related to physics in the example.
- You can give the function a BufferGeometry loaded from gltf.
- The mass is up to you (the best is to use meters, seconds and kilograms for all the length, time and mass units)
- Finally, for simulating cloth you can use 0 as the pressure. If you give a positive pressure the cloth will inflate like a balloon even if it is a not closed mesh. (Edit: To clarify, the cloth can be an open, double-sided rendered mesh)
Then, you can also stick the cloth to the person model at some vertices, with the so called anchor points. See the
webgl_physics_cloth example, where the function
softBody.appendAnchor() is used to glue the cloth to the crane arm. You can add anchors to a soft body, linked to a rigidBody or fixed in thin air.