Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!