# Camera angle for dimetric projection

I have a simple 3D engine and I want to make a isometric(dimetric) game, but where tiles are not real 3D planes, but 2D images like this one:
As I understand this tile is drawn in dimetric 1:2 projection But I can't get right camera angles in order to have view, where all given tiles would fit perfectly by pixel. After reading this page I've tried rotating camera relatively to itself by x=26.565deg y=45deg but that gave me bad result.

It's clearly visible, that tiles don't fit together nicely.
I've tried different value, by just handpicking them, and the closes one was x:30deg y:45deg angles. But there is a problem with gaps between tiles. It maybe somehow related to problem, that I don't know how to calculate length of one tile edge in world space, currently when I put tiles in scene I space them by 45units, which also is a handpicked value.

You would ask, "Why do I try to do this in 3D engine?". I want to mix 2D tile and object sprites with simple 3D objects in one game. I've already did isometric terrain with 2D engine, where everything can be simply calculated and doesn't need to position a camera.

• I love style of the "Isometrica" from the link you posted! Reminds me of The Rollercoaster Tycoon! Try looking for some clone of the game with opensource code. Might come in handy :) facepunch.com/showthread.php?t=1149898 Jul 7, 2013 at 15:24
• Dimetric projections actually don't have a "right" measure. You just have to have to axis with equal angles, with the other being any angle you want. BUT if you want like the older "isometric" 2D games, with 2:1 ratio, you can achieve this with Yaw: 45°, Pitch: 35.264°, If you want the precise angle of pitch, you can get it by arctan(sin(45°)) Jul 7, 2013 at 16:39
• Btw follow the wikipedia link, it even teach how to make the rotation matrix for this. Jul 7, 2013 at 16:40
• Gustavo Maciel, I know that there is infinite variation of dimetric, but I'm looking for one that would fit my given tile sprites. 35.264deg gives way too bad results, and as I understand this angle is for TRUE isometric projection, it described here gandraxa.com/isometric_projection.xml .
– user27061
Jul 7, 2013 at 19:45

## 2 Answers

Ok, got it!) It turns out that 30deg angle is perfect for this, I can't prove it matematicaly but it works. Problem with gaps also dissappeared, when I spaced tiles with distance of 45.261 between each other. 1/2LENGTH_OF_TILE_SPRITE_32PX * (1/Cos(45)) = 45.261.

I've been trying to get my 3d models line up with the 2D tiles I have used in Unity in an isometric view. Turns out its technically a 'Diametric" view and through experimenting I have found that placing an orthographic camera at Z-45d with an X value of 60.5d has resulted in them almost perfectly lining up. I'm not a math guy by any means no idea why it is, but its working. Hope this helps someone!