# Inverted X positioning in 3D space

Hi,
I’m just getting started with 3D programming and am trying to get a basic camera setup and a grid rendered.

My camera is setup like this:

``````cameraTarget = new Vector3 (0, 0, 0);
cameraPosition = new Vector3 (0, 30, -50);
projectionMatrix = Matrix.CreatePerspectiveFieldOfView (MathHelper.ToRadians (45), GraphicsDevice.DisplayMode.AspectRatio, 1, 1000f);
viewMatrix = Matrix.CreateLookAt (cameraPosition, cameraTarget, Vector3.Up);
worldMatrix = Matrix.CreateWorld (cameraTarget, Vector3.Forward, Vector3.Up);
``````

I then draw my grid resulting in this:

In the screenshot above, the origin (the part with a vertical green line) appears to be on the right hand side of the grid with positive x values moving to the left of the origin rather than the right.

My question is, am I misunderstanding something or doing something wrong?
Should a line between say 0 and 20 move to the left rather than the right of the origin?
Or have I some how done something to invert the X axis for my camera?

Thanks

I’m no expert, but it makes sense to me that positive X values go to the left in your screenshot, since you set the camera position as x: 0, y: 30, z: -50, and the look at as 0, 0, 0. I believe the X values would go to the right if you set the Z position as 50 instead of -50.

That makes sense, I knew it would be something simple like that

I guess I have the same issue with the Z axis now although that makes more sense.

I assume given Vector3.Forward is 0,0,-1, that means that with a camera at 0, 30, 50 looking at 0,0,0 then Z decreases as you move away from the screen.

So if I want to draw My grid with 0,0,0 in the lower left and the opposite point to the right and “into the screen”, I would need to chuck a - on all my z coords.