We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I am trying to wrap my brain around PVectors and using them to move objects. I simply wanted my circles to start in the center and move to a random location on the canvas. I get the movement part but not the target or the subtract functions.
void update() {
target.sub(location);
target.normalize();
target.mult (.1);
velocity.add(acceleration);
velocity.limit(20);
location.add(velocity);
}
target is a PVector that contains a random x/y the velocity add and the location add get the circle moving but I cannot get it to move to the target :( Help thanks
Answers
entire code?
@Chrisir ...sorry its really messy code that doesn't even come close to doing what I want. I literally just want to figure out how to get a circle to move to a random x and random y.
@GoToLoop thanks for those links but they just confused me more :) Not at that point yet
I have added the code below...I have gotten it to move towards a target but its in reverse...I also don't necessarily need acceleration...I want the ball to appear in the middle and move towards a random target and stop.