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

152
Visualizações
Check if rotation of model has changed?

How would you check if the rotation of a model has changed? tried:

 var oldRotate = this._target.quaternion;
  console.log('works returns vector3 quaternion: ', oldRotate);
   var newRotate = oldRotate;

      if (oldRotate != newRotate) {
             console.log('this isnt triggering');
     }

this doesn't work and yes it's in a 'loop'

also tried:

 var oldRotation = new THREE.Vector3();
      oldRotation.copy(controlObject.quaternion);
      
      controlObject.position.copy(pos);
      this._position.copy(pos);
  
      this._parent.SetPosition(this._position);
      this._parent.SetQuaternion(this._target.quaternion);
   
  
  
       var newRotation = new THREE.Vector3();
          newRotation.copy(controlObject.quaternion);
  
   console.log(oldRotation.equals(newRotation));

any ideas?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can't compare objects for equality using the ==/!= operator. This will merely compare the references to the objects, not their values. You will need to compare using the .equals method.

Also, in your example, you're assigning oldR to newRotate directly. I'm not sure if you've not included some intervening code. Either way, you should also be using .clone otherwise the != will never happen.

See: https://threejs.org/docs/#api/en/math/Quaternion for information about the clone and equals methods.

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