# coordinate system conversion

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

## Recommended Posts

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?

##### Share on other sites
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

##### Share on other sites
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)?

##### Share on other sites

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)