Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda