I made a MorphTarget with 3 influences
A sphere to → 1. Suzanne 2 . Torus and 3 . Square
gui = new dat.GUI()
gui.add(params, 'value', 0, 1).name('Suzanne').onChange((val) => {
mesh.morphTargetInfluences[0] = influence
})
gui = new dat.GUI()
gui.add(params, 'value', 0, 1).name('Torus').onChange((val) => {
mesh.morphTargetInfluences[1] = influence
})
gui = new dat.GUI()
gui.add(params, 'value', 0, 1).name('Square').onChange((val) => {
mesh.morphTargetInfluences[2] = influence
})
And apply all 3 influences randomly lets say
morphTargetInfluence[0] = 0.3
morphTargetInfluence[1] = 0.6
morphTargetInfluence[2] = 0.1
And it results in a mixed shape of Suzanne Torus and Square
Then I export it in GLTF
Upto this Everything Works fine
I am trying to make this into rigidbody in ammo.js
createRigidBody(mesh, shape, mass, pos, quat);
For that I need to get the shape which requires the geometry and vertices of the mesh
When I try to get load the mesh and get geometry
geometryofmesh = new THREE.Geometry().fromBufferGeometry(mesh.geometry)
It gets the original geometry of the sphere without the morphvalues
How can I obtain the shape of the morphed mesh with morph values
I did go through this forum https://discourse.threejs.org/t/update-and-get-the-new-mesh-of-a-morph-target/15911
But here the vertices is obtained for one morphtargetinfluence and also on run time .
But I have them stored in the mesh
I know this also invloves ammo.js but for the most part for obtaining the vertices and geometry it depends on three.js so thought this forum would be a great place