We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Could someone please say to me why in the following code the value of the BPosition PVector changes too? Thank you for your help.
``int Ballamount = 20;
PVector[] BPosition = new PVector[Ballamount];
PVector[] bbbpos = new PVector[Ballamount];
void setup() {
for (int i=0; i<Ballamount; i++) {
BPosition[i] = new PVector(random(width), 0);
}
for (int i=0; i<Ballamount; i++) {
bbbpos[i] = BPosition[i];
}
}
void draw() {
for (int i=0; i<Ballamount; i++) {
bbbpos[i].x += 5;
}
println(BPosition[0]);
}``
Answers
Please check this post: https://forum.processing.org/two/discussion/comment/81950/#Comment_81950
Kf
Thank you