Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

218
Vistas
Three.js - Rotate 3D model around real axes

I have centered an imported GLTF 3D Model around the axes:

enter image description here

However, when I rotate it using

scene.rotation.y += 0.01

It rotates around a completely different set of axes: See here for gif.

Here is my code (it is inside a react App.UseEffect):

const test = new SceneInit('myThreeJsCanvas');
test.initialize(); //seperate file for setting up camera and lighting etc
test.animate();

let loadedModel;
const glftLoader = new GLTFLoader();
glftLoader.load('./assets/planet/scene.gltf', (gltfScene) => {
   loadedModel = gltfScene;

   const center = new THREE.Vector3();
   center.z = -5
   gltfScene.scene.position.sub(center); //centering
   gltfScene.scene.scale.set(0.01, 0.01, 0.01);
   test.scene.add(gltfScene.scene);
});

const animate = () => {
  if (loadedModel) {
     //loadedModel.scene.rotation.x += 0.01;
     loadedModel.scene.rotation.y += 0.01;
     //loadedModel.scene.rotation.z += 0.01;
   }
   requestAnimationFrame(animate);
};
animate();

What am I doing wrong here? I have followed multiple other posts and methods, most including the now deprecated geometry all to no avail.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This was in fact nothing to do with my code. It was to do with the model's own origin set in the gltf file. To fix, I looked into the file with a text editor and changed the transformation matrix to be centered correctly. After this it rotated perfectly.

about 4 years ago · Juan Pablo Isaza 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda