Hi,
I need to draw a 3D shape, specifically a cube at different locations on a grid and to simulate that, I’m using the randomize function to give me random values for the parameters of “translate()” and also the “box()” function to draw the cube but all I get is the cube jumping from one location to another. I know the reason why, and its basically because as the translate location changes, the box location changes but what I actually want is for the box to stay at the old location and for a new box to be drawn at the new randomized location. Is there any simple solution I could use, because I tried some complicated solutions and I didn’t get anywhere.
Thanks in advance for your help
Hey,
unfortunately, my grid isn’t stationary and I can rotate it in different directions with the mouse so I can’ t get rid of the background(255) and by “jumping” , I mean the box is just redrawn at different locations on the grid.
I tried the idea of saving the locations to a PVector arraylist but it wasn’t redrawing the whole thing. I’ll try it again and post the code anyway to see I’m doing it right
Heey again, I stayed up to work on it and the PVector array worked after I tuned the code up a bit. i also needed to add another “translate” in the negative under the box() function to offset the cumulative nature of the main “translate” function. I got some help on the PVector from this link https://forum.processing.org/one/topic/sort-arraylist-with-pvector-on-distance-to-a-point.html
Thanks so much for your help, I really appreciate it:grinning: