# [XNA] Getting the origin at the bottom left of the screen

This topic is 3032 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys I decided to check out XNA and I was going through the tutorials, but one thing I cannot figure out is how to change the origin of my coordinate system on my window from top left to bottom left. So I want, relative to the window, x positive going right y positive going up I dont mind the direction of z How do I modify the code here to do this: http://msdn.microsoft.com/en-us/library/bb196414.aspx does it have something to do with this? :
viewMatrix = Matrix.CreateLookAt(
new Vector3(0.0f, 0.0f, 1.0f),
Vector3.Zero,
Vector3.Up
);

projectionMatrix = Matrix.CreateOrthographicOffCenter(
0,
(float)GraphicsDevice.Viewport.Width,
(float)GraphicsDevice.Viewport.Height,
0,
1.0f, 1000.0f);

Thanks for all the help in advance

##### Share on other sites
Is there a reason why you need this? I think it is hardcoded into the viewport to have the origin at top left. It would be simple to have a method that sets the position of objects based on the lower left corner though.

If you have an object at (50, 50) relative to a bottom left origin and your viewport is 800 x 600 then all you have to do is set the position as (50, ViewPort.Height - 50). If you make a nice function to do this it should be easy enough to use.

Before you go doing that though I'd really examine why you need to do it and would it be easier to just change your coordinate system to match XNAs default.

##### Share on other sites
Quote:
 Original post by DargIs there a reason why you need this?

No particular reason. I just wanted to know if it was possible to do so.

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
17
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002295
×