So what I want is to do something like
scene.forEachMeshInScene(function(mesh){
//And here I can do stuff
});
But sadly, that doesn't exist. How can I do something like this?
So what I want is to do something like
scene.forEachMeshInScene(function(mesh){
//And here I can do stuff
});
But sadly, that doesn't exist. How can I do something like this?
Share Improve this question asked Dec 4, 2014 at 1:13 ByteDuckByteDuck 1,8613 gold badges15 silver badges28 bronze badges1 Answer
Reset to default 14You can use the following pattern to iterate over the Mesh
objects in the scene
graph:
scene.traverse( function( node ) {
if ( node instanceof THREE.Mesh ) {
// insert your code here, for example:
node.material = new THREE.MeshNormalMaterial()
}
} );
three.js r.69