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

101
Vistas
Apply quaternion is not a function

I need some light on this question I'm trying to set vertices of a geometry using a quaternion and

geometry.attributes.position.array[x].applyQuaternion(quaternion)

is not working as expected I know this implementation as changed in the passed and I suspect that the problem is that

geometry.vertices[x]

is not available anymore

some one on this ?

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

0

The method .applyQuaternion() is only available in Vector3(), not in a simple number. You cannot perform 7.applyQuaternion() with a number. In this context, it doesn't make sense to apply a 3D rotation to a 1-dimensional value.

First, make sure you create a Vector3 with the XYZ coordinates of the vertex you're trying to manipulate by using the BufferAttribute.get... method:

// Create quaternion
const quat = new THREE.Quaternion();
quat.setFromAxisAngle( /* ... */ );

// Position attribute
const posAttrib = geometry.getAttribute('position');

// Let's get the XYZ components of the 7th vertex in the geometry
const twistVec = new THREE.Vector3(
    posAttrib.getX(7),
    posAttrib.getY(7),
    posAttrib.getZ(7)
);

// Now that you've created a Vec3, you CAN apply a quaternion
twistVec.applyQuaternion(quat);
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