Three.js - load JSON model once and add it multiple times

前端 未结 2 627
醉酒成梦
醉酒成梦 2021-01-14 16:17

Is it possible to load a JSON model once and add it to the scene multiple times with different scales, positions, etc?

If I add the Object3D() to an array, give a po

2条回答
  •  梦毁少年i
    2021-01-14 17:16

    You need to clone a model first and then set position and scale.

     for(var i = 0; i < 5; i++){ 
            var newModel = model.clone();
                newModel.position.set(i,i,i);
                newModel.scale.set(i,i,i);
    
                scene.add(newModel); 
    }  
    

    Updated: Example how you can create json model without load : Fiddle example or just simple add loop inside load function.

提交回复
热议问题