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

227
Vistas
Quaterion-rotate bone untill it alignes with a Vector3, three js

I want to rotate a bone so it is aligned with a Vector3 (directionToTarget), I have:

const directionToTarget = new THREE.Vector3(random, random, random); //pseudocode randoms
directionToTarget.normalize();

var Hand2worldQ = new THREE.Quaternion();
this._anchor['LeftHandIndex1'].getWorldQuaternion(Hand2worldQ); // gets Lefthand bone quaternion

this._mesh.skeleton.bones[ 0 ].quaternion.set( SomeFunctionThatMakesVecintoQuarternion(directionToTarget ); 
// this._mesh.skeleton.bones inherits Hand2worldQ/LeftHand rotation

SomeFunctionThatMakesVec3intoQuarternion(directionToTarget ) is what i need

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Object3D starts by looking down the 0, 0, 1 axis. You can use the Object3D.lookAt() method to make this object point towards your target vector. Then you can extract that rotation and use it for whatever else you need:

// Initialize an abstract object looking towards 0, 0, 1
const object3D = new THREE.Object3D();

// Rotate it so it looks towards the target xyz coordinates
object3D.lookAt(randomX, randomY, randomZ);

// This will now have the final rotation
const myQuaternion = object3D.quaternion;
console.log(myQuaternion);
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