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

103
Visualizações
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 Respostas
Responde à pergunta

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