Okay I have a terrain with the structure: terrain[x][y][z], and
I want to create an isometric camera system, using a grid approach.
Each element is assumed to be a cube, and it's default value will be 0 for air (1 for dirt, 2 for water, etc). This will allow for terrain of multiple heights, and also overhangs/caves. Player x,y,z should be converted to the exact center of the screen. This means there is sort of a hypothetical flat "view grid", with copies extending up and down to max and min elevation, respectively. I think this should work fine. It will allow me to use tricks like testing if there is "dirt" at z+1 to see if I need to render the top face of the current cube.
So that being said,
What is the best way to establish this base "view grid?"
Some things to keep in mind:
- Screen size will does not have a set ratio
- Cube size does have a set ratio
- The player is not limited to cube-size movement increments, but instead can have an effective location of ex. terrain[0][0.1][0.5].
Therefore:
- The cubes will not always fill the screen exactly, and will need to be padded.
- This padding will need to be accounted for with screen offsets.
- The cubes will need to be offset by an additional small amount: the player's distance from the center of the closest one.
I need to know the basic math, or a standard practical approach to this. Any help or thoughts would be greatly appreciated!
For clarification, I need the methods of getting the positions of the grey tiles in this image:
[attachment=24167:ISOEXDRAW.png]
Notice how the player (blue) is off center to the tile, but is still center in the screen. These are hypothetical locations which are to be translated into world coordinates.