Generic traverse function.
It performs Depth-First Search.
The traverser function will be executed for each descendants. You need to return their "children" in an array. If you want to stop the traversal, return false instead.
traverser
false
The "root" node
The traverse function. If the node has "children" return them in an array.
// replicate Three.js traverse for no reasonconst meshes = [];traverse( object3DRoot, ( object ) => { if ( object.isMesh ) { meshes.push( object ); } return object3DRoot.children;} ); Copy
// replicate Three.js traverse for no reasonconst meshes = [];traverse( object3DRoot, ( object ) => { if ( object.isMesh ) { meshes.push( object ); } return object3DRoot.children;} );
Generic traverse function.
It performs Depth-First Search.
The
traverserfunction will be executed for each descendants. You need to return their "children" in an array. If you want to stop the traversal, returnfalseinstead.