Different translate() for different shapes, but want the same translate for the shapes when using rotation().
in
Programming Questions
•
1 year ago
Hi!
I want the three boxes to rotate around the same origin point, but I still want to be able to set different x,y,z positions for each individual box.
Example (obviously rotating around different origin points):
//First box
pushMatrix();
translate(x1+500,y1+300,z1);
rotateY(rX);
fill(255,0,0);
box(100,100,100);
popMatrix();
//Second box
rotateY(rX);
fill(255,0,0);
box(100,100,100);
popMatrix();
//Second box
pushMatrix();
translate(x1+100,y1+300,z1);
rotateY(rX);
fill(0,255,0);
box(100,100,100);
popMatrix();
translate(x1+100,y1+300,z1);
rotateY(rX);
fill(0,255,0);
box(100,100,100);
popMatrix();
//Third box
pushMatrix();
translate(x1+300,y1+200,z1);
rotateY(rX);
fill(0,0,255);
box(500,500,0);
popMatrix();
pushMatrix();
translate(x1+300,y1+200,z1);
rotateY(rX);
fill(0,0,255);
box(500,500,0);
popMatrix();
Thank you in advance!
1