-2

i want to make many lines use line renderer and i need double array. One of them is number of lines, and other one is data of points position.

...
positions[n + 1] = new Vector3(positions[n].x + Bxpe, positions[n].y + Bype, positions[n].z + Bzpe);
linerenderer.SetPositions(positions);
...

it work when number of line is one but

...
positions[z,n + 1] = new Vector3(positions[n].x + Bxpe, positions[n].y + Bype, positions[n].z + Bzpe);
linerenderer[1].SetPositions(positions[???]);
...

when i want to make like this, i dont know how write it right way.

pleace help

derHugo
  • 83,094
  • 9
  • 75
  • 115
Zolboo
  • 1
  • 1
    Can you explain better what is your end goal? Can you also share what steps you took to try to solve your problem. please share a bit of code that can show the point where you are stuck – berserck Sep 29 '22 at 13:21

1 Answers1

0

If you really want to keep using a 2d-array checkout how to "slice" arrays out of it

However, in your case instead of a 2-dimensional array

Vector3[,]

I would rather simply use a jagged array

Vector3[][]

and then do e.g.

positions[z][n + 1] = positions[z][n] + new Vector3(Bxpe, Bype, Bzpe);
...
linerenderer[z].SetPositions(positions[z]);
derHugo
  • 83,094
  • 9
  • 75
  • 115