hello everybody, I was trying to create object by merging multiple object, but the final object is not same as the single object.
see the image.
This appears when i manually add all the object in the scene. The handles are white in color. but when i try to merge into a single object. the result changes. the handles also take the texture and this i what i don’t want
the merged code and is shown below.
var geometry = new THREE.CylinderGeometry( 1, 1, 20, 32 );
var material = new THREE.MeshPhongMaterial( {color: 0xffffff} );
var cylinder = new THREE.Mesh( geometry, material );
cylinder.scale.set(0.02,0.02, 0.02);
cylinder.position.x = -0.18;
cylinder.position.y = 0.28;
cylinder.position.z = 0.82;
cylinder.rotation.x = 0;
cylinder.rotation.y = 0;
cylinder.rotation.z = 0;
cylinder.updateMatrix();
var geometry = new THREE.CylinderGeometry( 1, 1, 8, 32 );
var material = new THREE.MeshPhongMaterial( {color: 0xffffff} );
var cylinderleft = new THREE.Mesh( geometry, material );
cylinderleft.scale.set(0.02,0.02, 0.02);
cylinderleft.position.x = -0.18;
cylinderleft.position.y = 0.45;
cylinderleft.position.z = 0.74;
cylinderleft.rotation.x = 1.6;
cylinderleft.updateMatrix();
//this is where the merging is done
var singleGeometry = new THREE.Geometry();
singleGeometry.merge(top.geometry, top.matrix);
singleGeometry.merge(bottom.geometry, bottom.matrix);
singleGeometry.merge(left.geometry, left.matrix);
singleGeometry.merge(right.geometry, right.matrix);
singleGeometry.merge(middle1.geometry, middle1.matrix);
singleGeometry.merge(middle2.geometry, middle2.matrix);
singleGeometry.merge(back.geometry, back.matrix);
singleGeometry.merge(cylinder.geometry, cylinder.matrix);
singleGeometry.merge(cylinderleft.geometry, cylinderleft.matrix);
singleGeometry.merge(cylinderRight.geometry, cylinderRight.matrix);
singleGeometry.merge(cylinder1.geometry, cylinder1.matrix);
singleGeometry.merge(cylinderleft1.geometry, cylinderleft1.matrix);
singleGeometry.merge(cylinderRight1.geometry, cylinderRight1.matrix);
var material = new THREE.MeshPhongMaterial({map:texture}); // if i remove the texture, the object is showing white. i thing some thing have to be done here which is overriding all the texture
var mesh = new THREE.Mesh(singleGeometry, material);
mesh.scale.set(0.35,0.5,0.5);
objects.push(mesh);
scene.add(mesh);
any help will be really appreciated