0

How can i make object that i load in with GLTF loader as 1 mesh. When i move them with mouse ( drag and drop) they are moving as separate objects, also when im trying to check the size in console... it has like 100 lines of the same size over and over.

          var loader = new THREE.GLTFLoader();
          loader.load( `objekt.gltf`, ( gltf ) => {
                this.scene.add( gltf.scene );
                gltf.scene.traverse( function( object ) {
                 console.log(" GALDS " );        
              var box = new THREE.Box3().setFromObject( object );
                console.log( box.getSize() );
                        if ( object.isMesh ) {
                        objects.push( object );
}               
                    } );
                });
Krizs
  • 65
  • 8
  • To merge them into one mesh you need to use modeling software. But you can still move them as one without doing that, just set `gltf.scene.position` or `new THREE.Box3().setFromObject( gltf.scene )` for example. – Don McCurdy Mar 31 '18 at 05:13
  • I mean, when i'm dragin object with mouse it takes a separate part of an object instead of full object – Krizs Mar 31 '18 at 12:09
  • @Krizs See https://stackoverflow.com/questions/26202064/how-to-select-a-root-object3d-using-raycaster/26205768#26205768 – WestLangley Mar 31 '18 at 16:55

0 Answers0