We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I've been using ortho() function for isometric projection. It's great. Now I wonder what's the best approach for a simple game.
I have this example,
void setup() {
size(400, 400, P3D);
ortho(0, width, 0, height); // same as ortho()
stroke(255);
noFill();
}
void draw() {
//lights();
background(0);
translate(width/2, height/2, 0);
rotateX(-PI/6);
rotateY(map(mouseX, 0, width, 0, 2*PI));
box(width/3);
}
However, I am rotating the whole canvas. Should I rotate the camera instead? Is there any little advice on how to make an isometric room, considering walls in a future?
You know, when making a 2d grid, you start from the top left generally, so you're attached to that point when rotating for example. would it be convenient to make everything relative to the center of the grid?
Answers
Hi redraw, I found this article on How to position the camera for isometric assets to be helpful on the first question. Hopefully I got the maths right below, not every dev environment has the same + and - poles for y and z axes.
you can isolate two boxes with pushMatrix / popMatrix
it is advisable to draw everything over the origin 0,0, e.g. from -30 to 30 - box does this aitomatically.