This project is read-only.

Custom Camera

Feb 10, 2012 at 10:07 PM

Hello there, would first all of like to say, what an amazing library you have here, it's an absolutely wonderful tool to work with, I just have a question about custom cameras.

I've looked through the current discussions here and haven't been able to find anything to help my situation.

I've started a new XNA 4.0 Windows Game just to get to grips with the engine and have a feel for how everything works, and its great, but when I get round to integrating my own camera, everything goes tits up.

I've got a simple 2d camera class, with a public transformation matrix, however nothing shows up on screen when I run the game, I just get the shadow overlay, when I comment out the camera matrix and use the 3 lines of Matrix code at the top of the draw function in the TestBed example, it works fine.

Here is the top of my draw function in Game1:

Matrix world = Matrix.Identity;
Matrix view = Matrix.CreateTranslation(new Vector3(0, 0, 0) * -1f);
Matrix projection = Matrix.CreateOrthographic(this.mVerticalUnits * this.GraphicsDevice.Viewport.AspectRatio, this.mVerticalUnits, 0, 1);

this.krypton.Matrix = world * view * projection;
//this.krypton.Matrix = camera.Transformation;

this.krypton.Bluriness = 4;



And here is the Transformation code from the camera class:

public Matrix Transformation
            get { return Matrix.CreateScale(1.0f) * Matrix.CreateTranslation(new Vector3(-this.position, 0f)); }

I've used this camera transformation in another game I've made and it works fine, so I'm guessing I'm just missing something when it comes to implementing it with this engine. I have a sneaky suspicion it has something to do with the position of the lights, but I'm not 100% so I'm a little sceptical at the moment.

Any help would be greatly appreciated, thanks in advance,


Feb 14, 2012 at 4:40 AM
Edited Feb 14, 2012 at 4:46 AM

Read here

Feb 21, 2012 at 6:41 PM

Hi Burns!

Does the link provided by squizzle help clear up some of the camera confusion?