@0b5vr/experimental
    Preparing search index...

    Function traverse

    • 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.

      Type Parameters

      • TNode

      Parameters

      • root: TNode

        The "root" node

      • traverser: (node: TNode) => false | TNode[]

        The traverse function. If the node has "children" return them in an array.

      Returns void

      // replicate Three.js traverse for no reason
      const meshes = [];
      traverse( object3DRoot, ( object ) => {
      if ( object.isMesh ) {
      meshes.push( object );
      }
      return object3DRoot.children;
      } );