Equal PVectors

edited December 2016 in Questions about Code

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]);
}``
Tagged:
Sign In or Register to comment.