Im just working on Daniel Shiffman's Nature of Code book and I have the following problem with the exercise 1.8.
I have an object (ellipse) which should move towards the cursor mouse. My Problem is now that I don't know how to control the speed of my object. The object should move faster when it is farther away but my object is just keeping the same speed all the time. How can i control this by changing only the acceleration? I know it has to do something with the distance between these two points.
Here is my small update Code in my object:
void update() {
PVector mouse = new PVector(mouseX, mouseY);
PVector dir = PVector.sub(mouse, location);
float mag = dir.mag();
dir.normalize(); //now we have just the direction to the mouse
I want to ask you how strong is Processing at performance. Is it possible to write a 3D Game like Need for Speed 2 for example? Im writing currently a 2D game and im thinking of changing the engine because i dont want that my game laggs in the end.
How strong is Processing? And by the way i read that i could integrate OpenGL to Processing. Does it work better with OpenGL?