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

206
Views
ThreeJS updating an FBX Object's attributes after async load

I'm loading an FBX Object into the scene

const loader = new FBXLoader();
        loader.load( '{{asset('models/model.fbx')}}', function ( logo ) {
            scene.add( logo );
            logo.position.y = 0;
            logo.position.x = 0;
            logo.position.z = 0;
            logo.updateMatrix();
        });

Since "logo" is an async loaded FBX object, I cannot access its properties outside the loader function.

How do I achieve to make its attributes like position, rotation and so on, accessable outside the loader?

I already tried to put anything (including the animate() function) into the loader - but this seems to be not the "clean" way...

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Consider to utilize the async/await pattern in your app which makes the code easier to understand. And cleaner.

const loader = new FBXLoader();
const logo = await loader.loadAsync( '{{asset('models/model.fbx')}}' );
scene.add( logo );

Notice the usage of loadAsync() which is available for all loaders. You most likely have to refactor your code so the new await does not break your app. You can avoid this by making the surrounding method/function async.

almost 4 years ago · Santiago Trujillo Report
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!