I’m trying to create an interaction with the mouse to click and pull the vertices to create distortions in the model, so first I’m trying to create “springs” for every face of the imported model, but I can’t seem to access them in the geometry.
I suppose the faces would be part of the geometry, but if I log this out I can’t find them:
console.log(obj.children[0].geometry);
Shall I somehow create them after importing the model or is there another approach?
It’s more promising to traverse through the scene provided by GLTFLoader like so:
gltf.scene.traverse( function( object ) {
if ( object.isMesh ) {
// do something with object.geometry
}
} );
It’s important to know that there is no face data structure you can directly use. Since the loader returns BufferGeometry you have work with attributes in order to access the vertex data of a single face. You can find more information about BufferGeometry/ BufferAttribute and how they are used in the documentation and the official examples.