Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!