Look at ArrayList and set one up to type PVector
(before setup()
)
Then in a for loop make PVectors and add them to the arraylist
(All in setup()
)
In draw() read and show arraylist
See reference ArrayList
Example
import peasy.*;
PeasyCam cam;
ArrayList<PVector> list = new ArrayList();
void setup() {
size(1300, 1300, P3D);
cam = new PeasyCam(this, 200);
// randomSeed(0);
for (int i=0; i<5; i++) {
float posx=random(0, 150);
float posy=random(0, 150);
float posz=random(-450, 0);
list.add(new PVector(posx, posy, posz));
}
}
void draw() {
background(0);
lights();
noStroke();
fill(255, 0, 0);
for (PVector pv : list) {
pushMatrix();
translate(pv.x, pv.y, pv.z);
sphere(14);
popMatrix();
}
}