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

140
Vistas
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 Respuestas
Responde la pregunta

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 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