Here's how to translate objects in P3D:
size(200, 200, P3D); //Starting P3D renderer
fill(255, 0, 0, 150); //transparent red
rect(10, 10, 100, 100); //first rectangle
fill(0, 0, 255, 150); //transparent blue
translate(50, 50, 50); //translate x, y and z by 50 pixels
rect(0, 0, 100, 100); //second rectangle (same dimensions as the first one)
Red: first rectangle Blue: second rectangle
As can be seen from the above sketch, the second rectangle only appears to be larger than the first one, when in reality it is "closer" to the screen as a result of translating the rectangle 50
pixels along the z-axis
(and of course, the rectangle has been translated along the x
and y
axes).