swarm // network // time
in
Programming Questions
•
7 months ago
Hi, I am currently working on a swarm that seeks a point in a network of points. I was having trouble figuring out how to work with time. As in, I want the swarm to seek a point for a given amount of time and then move on to another point that is randomly selected. I have the code for seeking a random point in the network and I just need help understanding how to get it to seek a specific point for a given time then move to the next. any help would be awesome!!!!!!
three classes /// ted_network, ball, network
here is the code for seek in the ball class
void seek(){
int networkSize = networkCollection.size();
Network destination = (Network) networkCollection.get(int(random(networkSize - 1)));
// println(destination.loc);
Vec3D dif = destination.loc.sub(loc);
float distance = dif.magnitude();
dif.normalize();
dif.scaleSelf(0.05);
acc.addSelf(dif);
}
Thanks in advance
thomas
1