Random walker through points

That right, my bad! (still a beginner)

int getNearest(ArrayList<Anchor> anchors) {
    float record = 1000;
    int idx=0;
    for (int i = 0; i < anchors.size(); i++) {
      Anchor anchor = anchors.get(i);
      float dist = pos.dist(anchor.pos);
      if (dist < 50) {
        if (dist < record) {
          record = dist;
          idx = i;
          //if (idx == 0){break;}
        }
      }
    }
    return idx;   

Would you know a method to stop the waker should the point being too far?

thank you

1 Like