• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

136
Vistas
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 3 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

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 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda