How to add Ammo.js Physics to MD2Character?

that’s a pretty old version :sweat_smile:
The first step is to output a log of your mesh in your browser, something like: console.log(myMesh)
Ammo need a specific geometry attribute: Float32BufferAttribute, and I fear yours is not compatible.

This is a common issue when using mesh from loaders (like GLTF and other add-ons)

A possible fix is to use a hidden function from BufferGeometryUtils.js https://github.com/mrdoob/three.js/pull/23814/files
It was included to ease the workflow with physics/BVH engines on custom mesh.
Further informations about the process can be found here: three.js - How to get regular float32 geometry of a mesh compressed using gltfpack - Stack Overflow

But to be honest…your three version is so old you may be forced to rewrite your own attribute quantizing function for THREE.MorphBlendMesh

1 Like