# Calculate new coords of camera after a 90 degree rotation in an isometric 2D projection

I made a 2D isometric renderer. It works fine but now I want to show my scene from 4 different points of view (NE NW SE SW) but, on a 90° rotation, my camera cannot keep the center of my scene on screen.

What's working :

• I calculate new projection of scene to match the new viewport (x y z in my world).
• I reorganise part of my scene(chunk) to draw them in a correct order
• I reorganise 'tiles' of 'chunks' to draw them in a correct order
• I can keep the correct center with a 180 degrees rotation.

What's do not working :

• I cannot find a correct translation to apply to my camera after a 90 degrees rotation.

What I know :

• To keep the same center on a 180° rotation with my camera I have to do this :

`camera.Position -= new Vector2(2 * camera.Position.X + camera.Width, 2 * camera.Position.Y + camera.Height);`

Illustation of the problem :

-

I resolved my issue by calculating tile elligeable to be the center of the screen. Then, I pick up the nearest one of the camera and, after a rotation, I put it back to the middle of the screen. It's a quite easy like this but finally I have to calculate the tile in the center of my screen (because Z axis).

-

How about putting your camera in the center of what you want to render, set the near plane behind the camera and the far plane in front of it?

If you do this, you don't have to move your camera when you rotate.

-
I asked this question in stackoverflow too, there is a guy who gave me a nice trick with a Matrice rotation, I'll test this evening and I'll report here if my problem is resolved or not. – Cyril ALFARO Feb 22 '13 at 16:12
@CyrilALFARO make sure you let everybody know of the answer if you figure it out! – Panda Pajama Feb 23 '13 at 9:44
yes of course, I did correctly my rotation with 90°, Vector2(new_camera_x,new_camera_y) = new Vector2(-(old_camera_y - old_camera_height)/2,old_camera_x*2), or a kind of. It 's correct for a Z = 0 in my world but if I change altitude, all is wrong. So finally I need to find the center of my scene (X Y Z) and rotate arround it (par matrice ou simple decallage avant/apres). – Cyril ALFARO Feb 24 '13 at 12:38
I have rights now to add images so I put them. – Cyril ALFARO Feb 24 '13 at 12:43
I resolved my issue by calculating tile elligeable to be the center of the screen. Then, I pick up the nearest one of the camera and, after a rotation, I put it back to the middle of the screen. It's a quite easy like this but finally I have to calculate the tile in the center of my screen (because Z axis). – Cyril ALFARO Feb 25 '13 at 0:04