Sign in to follow this  

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

Recommended Posts

Firecore    155
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: does it have something to do with this? :
viewMatrix = Matrix.CreateLookAt(
    new Vector3(0.0f, 0.0f, 1.0f),

projectionMatrix = Matrix.CreateOrthographicOffCenter(
    1.0f, 1000.0f);
Thanks for all the help in advance

Share this post

Link to post
Share on other sites
Darg    213
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 this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this