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

241
Vistas
How do I make it that a vector in an array doesn't change its values?

When I insert a vector in an array and change the value of the vector, it also changes in the array. How can I safe data in an array in type of a vector without it changing the value when I change the value of the vector?

const array10 = [];
let vector = new THREE.Vector3(0,0,0);
array10.push(vector);
vector.x = 10;
console.log(array10[1]);

Output: (10,0,0)

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

0

Put a copy of the vector in the array. A new vector3 with the same x, y, and z values can be created with clone():

array10.push(vector.clone());
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