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

168
Visualizações
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 à 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