Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Three.js Detect if Traverse is complete

Is there a way to check if the traverse function is complete (finished traversing the scene)?

Something like (example)

fbx.traverse( function( c )
    if ( c instanceof THREE.Camera ) {      
        // Debug log camera child
        console.log( c 

}).onComplete(function( e ) {
    // Do something on complete
}

Explanation of problem: Whena user selects a FBX file, it traverses it for all cameras. If it's a valid FBX file, and successfully read, it then processes 'FBX loaded. Found ' + count + ' camera(s).'

The issue is, when I load a FBX file, I can cleary see it states "0" cameras, before the traverse has found a camera. Then it changes to 1. I'd like to know when the traverse is complete, so the user can be notified it's safe to export converted camera file.

Otherwise they may download before the traverse function is even complete.

Current Code

reader.addEventListener( "load", function( e )
    const buffer = event.target.result,
          loader = new THREE.FBXLoader(),
          fbx = loader.parse( buffer );
          
    var count = 0;
    
    fbx.traverse( function( c )
        if ( c instanceof THREE.Camera ) {      
            // Debug log camera child
            console.log( c 
            count+
    
    });
    
    msg.innerHTML = '<span class="green">FBX loaded. Found <strong>' + count + '</strong> camera(s).</span>';
    
    
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!