Some time ago decided to make an "2,5d" isometric strategy game. I decided ill go with a 3d engine with a locked orthographic camera for the benefit of easier collision detection, easier depth sorting and because i wanted to try myself in 3D. I come from a Java background, so i've chosen C#/Monogame. After reading some articles on the internet i finally created camera that would display things the way i want but i have this feeling at the back of my head i've done something hooribly wrong/stupid. My camera setup looks like this:

basicEffect = new BasicEffect(GraphicsDevice);

Matrix ypr = Matrix.CreateFromYawPitchRoll(0, 0, MathHelper.ToRadians(-45f));

Matrix rotation = Matrix.CreateFromAxisAngle(new Vector3(1,-1,0), MathHelper.ToRadians(45f));

camPosition = Vector3.Transform(new Vector3(0, 0, 500), rotation);
camTarget = Vector3.Forward;
camUp = Vector3.Transform(Vector3.Up, ypr);

worldMatrix = Matrix.CreateWorld(new Vector3(0, 0, 0), Vector3.Forward, Vector3.Up);
viewMatrix = Matrix.CreateLookAt(camPosition, camTarget, camUp);
projectionMatrix = Matrix.CreateOrthographicOffCenter(0f, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0f, 0f, 5000f);

Ive drawn some lines along the x and y axis and the camera seems to produce the "expected result" of

enter image description here

Is there a better/more canonical way of creating camera like that? I tried using


And transforming the camera position with it but the camera just refused to rotate around the Z axis, nothing happened.

So. Is there a "proper" way of setting up a view like this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.