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

169
Vistas
Three.js - How can I control two object’s rotation in realtime with quaternions

I would like to copy the rotation of one object to another in realtime. I understand I can do this by copying the quaternion of object 1 to object 2. I've functionally gotten this to work when loading new objects in they will snap to the position of object 1. I would like to do this in realtime vs snapping. So as I rotate object 1 object 2 follows. I understand that this needs to be added to the renderloop but I'm getting issues of object1.getObjectByName('forearm') is not a function.

Code:

function init() {

 const quaternion = new THREE.Quaternion();
}

 function loadObject1(modelPath, x = 0.1, y = 0.1, z = 0.1) {
        gltf_loader.load(modelPath, function (gltf) {
          scene.remove(object1);
        
         object1 = gltf.scene;

          gltf.scene.traverse(function(object) {
if(object.isMesh) object.frustumCulled = false;
});
               
          gltf.scene.scale.set(x, y, z);
          object1.position.set( 0, -2, 20)

        object1.getObjectByName('forearm').quaternion.copy(object2.getObjectByName('forearm').quaternion);
          
         

          scene.add(object1);
          
          
        });
      }

 function render() {
        

        renderer.render(scene, camera);
object1.getObjectByName('forearm').quaternion.copy(object2.getObjectByName('forearm').quaternion);
      }

     function loop() {
        requestAnimationFrame(loop);
           
        renderer.render(scene, camera);
      } 

about 4 years ago · Juan Pablo Isaza
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