• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# coordinate system conversion

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1limesX  Members

Posted 18 May 2012 - 09:24 AM

hi. my first post.... hope someone can help.
i am trying to build my own simulator and i am using some of flightgears methods and concepts.
i have trouble understanding something.

flight gear uses cartesian coordinate system (The X axis runs along a line from the center of the earth out to the equator at the zero meridian. The Z axis runs along a line between the north and south poles with north being positive. The Y axis is parallel to a line running through the center of the earth out through the equator somewhere in the Indian Ocean). origin is the center of the earth.

now, in my program i want my origin to be my camera position (0,0,0).
how to convert cartesian to XNA coordinate system?

### #2DementedCarrot  Members

Posted 18 May 2012 - 03:01 PM

If I'm reading this right, I think you have your concepts mixed up.

XNA doesn't necessarily follow a specific coordinate system, but for 99% of all examples on the internet the "XNA" coordinate system is a cartesian coordinate system. A cartesian coordinate system is simply a coordinate system where the X/Y/Z coordinates define locations along the cardinal directions (generally) right/up/forward. I recommend you give http://en.wikipedia....ordinate_system a glance.

Even so, I recommend against defining the origin around your camera. Assuming your camera moves, you won't want to constantly redefine the locations of every object in the world in relation to your camera. That code would be harder and much less efficient. I also recommend you look for a basic introduction to vector math and matrix transformations.

Edit: Also, are the lines you mention straight or wrapped around the planet? If they are wrapped, you are talking about a polar coordinate system.

Edited by DementedCarrot, 18 May 2012 - 03:04 PM.

### #3limesX  Members

Posted 18 May 2012 - 09:10 PM

My camera is sort of "static". You can just look around with camera, no movement (translation) or rotation. So I think for me is good to have my origin at camera position.
The problem is, when I convert my lat,long,altitude position of my camera location to cartesian system the flightgear uses i get some big value(from my head 451322,461325,12453).... I want this to be 0,0,0. And everything else in game positioned relative to my camera.. What are the correct calculations (transformations)?

### #4Tournicoti  Prime Members

Posted 19 May 2012 - 05:56 AM

My camera is sort of "static". You can just look around with camera, no [...] rotation.

I'm not sure I understand what you mean :
Looking around with camera implies rotating camera, isn't it ?
And if you rotate your camera, you'd have to recompute the locations of the objects, even if the camera stays always at (0,0,0) (because you work in view-space)