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

289
Vistas
THREE.js rotation to marked face

I have stuck with rotating objects in THREE.js. My situation looks like that. I click on the surface and I detect what triangle is it. Next, I get the normal vector of my selected triangles and the normal vector for my floor and I want to rotate the object so that the selected triangle lies on the floor. But always when I calculate Quaternion from my floor normal vector and triangle normal vector and I try to apply to my object, that rotation is completely wrong.

let triangleNormal: Vector3 = new Vector3();
triangle.getNormal(triangleNormal);
console.log('Triangle normal', triangleNormal);

const normals = floor.geometry.getAttribute('normal');
const floorNormal = new Vector3();
floorNormal.fromBufferAttribute(normals, i);

const quaternion = new THREE.Quaternion();
quaternion.setFromUnitVectors(floorNormal, triangleNormal);
targetObject.applyQuaternion(quaternion);

Does someone have an idea what I'm doing wrong?

about 4 years ago · Santiago Trujillo
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