Hello,
I am trying to update a Mesh in a group.
If I create a new Mesh and add it to the group, the hierarchy is preserved but the recalculation is slightly off.
let sp = new THREE.Mesh(connector_geometry, backbone_materials[Math.floor(current_nuc.my_strand % backbone_materials.length)]);
sp.applyMatrix(new THREE.Matrix4().makeScale(1.0, sp_len, 1.0));
sp.applyMatrix(rotation_sp);
sp.position.set(x_sp, y_sp, z_sp);
current_nuc.visual_object.add(sp);
If I simply recalculate using the current Mesh, either the Mesh continues to rotate and grow in size.
let sp = current_nuc.visual_object.children[4];
sp.applyMatrix(new THREE.Matrix4().makeScale(1.0, sp_len, 1.0));
sp.applyMatrix(rotation_sp);
sp.position.set(x_sp, y_sp, z_sp);
If I create a new Mesh and push it to the children array of the group or set it to the current Mesh, the new Mesh is correct but the the parent hierarchy is deleted.
let sp = new THREE.Mesh(connector_geometry, backbone_materials[Math.floor(current_nuc.my_strand % backbone_materials.length)]);
sp.applyMatrix(new THREE.Matrix4().makeScale(1.0, sp_len, 1.0));
sp.applyMatrix(rotation_sp);
sp.position.set(x_sp, y_sp, z_sp);
current_nuc.visual_object.children[4] = sp;
How do I get the correct calculations and maintain the hierarchy?
Thank you for all of your help!