K
K
Kirill Zhuravlev2019-03-13 08:42:18
JavaScript
Kirill Zhuravlev, 2019-03-13 08:42:18

How to remove part of a model in threeJS?

On the stage I have a model, it is initialized and added to the stage like this.

var loader = new THREE.FBXLoader();
loader.load( 'data/nameOfModel.FBX', function ( object ) {
  model = object;
  model.name = 'lighter';
  scene.add( model );
} );

Here is the structure of the scene in the debugger:
5c88979d34322889912025.png
You need to remove "10_30_60".
Tried Didn't work. Please tell me how can I check this. It is still advisable to delete by name, because. the model will have many such parts.
scene.remove(scene.getObjectByName('10_30_60'));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Zhuravlev, 2020-10-24
@zhuravlevkk

Is it useful to anyone

function clearScene(object) {
  while(scene.children.length > 2){ 
    scene.remove(scene.children[2]); 
  }
}

This clears the entire scene.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question