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

369
Views
¿Por qué no puedo declarar una posición en mi matriz multidimensional?

Estoy tratando de hacer una versión 3d de un L-Syste. Pero no puedo declarar elementos en mi matriz multidimensional. Cuando depuro, veo que el elemento permanece igual. Llamo por ejemplo arraygrowth [0][1] = 100; Pero el elemento en esa posición se mantiene en 0

 let arraygrowth =[]; arraygrowth.push(new THREE.Vector3(0,0,0)); arraygrowth.push(new THREE.Vector3(0,0,0)); arraygrowth.push(new THREE.Vector3(0,0,0)); arraygrowth [0][1] = 100; arraygrowth [1][1] = 100; arraygrowth [2][1] = 100;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Limpiando tu código, esencialmente estás haciendo esto:

 let arraygrowth =[]; arraygrowth.push(new THREE.Vector3(0,0,0)); arraygrowth.push(new THREE.Vector3(0,0,0)); arraygrowth.push(new THREE.Vector3(0,0,0)); arraygrowth [0][1] = 100; arraygrowth [1][1] = 100; arraygrowth [2][1] = 100;

Este es el equivalente de new THREE.Vector3(0, 0, 0)[1] = 100; ... que no tiene sentido. Que así no es como cambias los parámetros x, y, z de un Vector3. Cuando llamas a arraygrowth[0] , obtienes un Vector3 , y ahora tienes que usar una de sus propiedades o métodos para asignar el valor que deseas. Por ejemplo:

 arraygrowth[0].y = 100; // Sets y value arraygrowth[0].setY(100); // Also sets y value arraygrowth[0].setComponent(1) = 100; // Also sets y value

https://tresjs.org/docs/#api/en/math/Vector3.setComponent

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!