Isometric Camera trouble - can't rotate or move correctly

Posted by Deukalion on Game Development See other posts from Game Development or by Deukalion
Published on 2012-07-09T17:48:30Z Indexed on 2012/07/09 21:24 UTC
Read the original article Hit count: 235

Filed under:
|
|
|
|

I'm trying to create a 3D editor, but I've been having some trouble with the Camera and understanding each component. I've created 2 camera that works OK, but now I'm trying to implement an Isometric Camera in XNA without success on the rotation and movement of the camera. All I get working is Zoom.

my standard view for isometric camera

(Cube with x=3f, y=3f, z=1f in center)

And this is the constructor for my IsometricCamera (inherits from ICamera, with methods for Rotation, Movement and Zoom, and Properties for World/View/Projection matrices)

public IsometricCamera3D(GraphicsDevice device, float startClip = -1000f, float endClip = 1000f)
{
    matrix_projection = Matrix.CreateOrthographic(device.Viewport.Width, device.Viewport.Height, startClip, endClip);

    rotation = Vector3.Zero;

    matrix_view =
        Matrix.CreateScale(zoom) *
        Matrix.CreateRotationY(MathHelper.ToRadians(45 + 180)) *
        Matrix.CreateRotationX(MathHelper.ToRadians(30)) *
        Matrix.CreateRotationZ(MathHelper.ToRadians(120)) *
        Matrix.CreateTranslation(rotation.X, rotation.Y, rotation.Z);

}

Problem is when I rotate it, all that happens is that the Cube gets more or less shiny and nothing happens. What is wrong and how should I create my View matrix to move it / rotate it correctly?

Rotate, Move and Zoom looks like:

MethodName(Vector3 rotation/movement), Zoom(float value);

and just increases the value, then calls an update to recreate the View Matrix according to the code in the constructor.

Currently, in my editor I use MiddleButton + Mouse Movement to rotate the camera, but it's not working as the other camera. But in my default camera I use World Matrix to move, but I guess that's not the best way to go which is why I'm trying this.

© Game Development or respective owner

Related posts about XNA

Related posts about c#