Transform and mouseX, mouseY
in
Programming Questions
•
2 years ago
Hi all,
apologizing in advance for the basic questions as I am still very new to programming.
I basically have created an array of objects that revolve around the center using rotate and transform. This is in the display function of the object, where theta is a random number.
pushMatrix ();
rotate (theta);
translate (distance, 0);
stroke (0);
fill (175);
imageMode (CENTER);
etc etc
popMatrix ();
The first problem is that I want the objects to react when they come into contact with mouseX, mouseY using the distance function. Unless I am missing something (which is very likely), mouseX and mouseY don't seem to exist in the same 'transformation matrix' that the objects do, so I can't use the distance function. That's one issue.
Another one is that since the coordinates of each generated object from the array are (0, 0) because their locations are based on the transformation, I dont know how you would get the distance of mouseX, mouseY relative to them.
Any help at all would be most appreciated.
1