# XNA - Z axis backwards?

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

## Recommended Posts

Been messing around with XNA and looking at some online tutorials and noticed something odd. This one in particular: http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/World_space.php He defines a triangle with vertices: Red = (0,0,0) Yellow = (5, 10, 0) Green = (10, 0, -5) Now, if I positioned the camera at say 0,0,-40, and look at the origin, I would expect the Green vertex to be on the right. However, he positions the camera at positive 40 to make the Green be on the right. Is there something about the coordinate space in this XNA framework backwards? Thanks!

##### Share on other sites
XNA is by default right handed, which is no doubt confusing since most direct X examples are left handed, although the functions exist in both LH and RH versions. RH coordinates have the Z axis pointing in the opposite direction from LH coordinates (positive Z is out of the screen in RH, and into the screen in LH). Also the winding order of the vertices is CCW instead of clockwise.

see the math entry here:
http://msdn2.microsoft.com/en-us/directx/aa937797.aspx

You are stuck with it since they took away all of the LH functions. Of course if you have old code, its not that hard to invert the Z axis on the matrices or flip the winding order of the vertices or the cull mode.

##### Share on other sites
Thanks, that was a great article. The next odd thing, back to that example tutorial link, is he sets up the index buffer with CW vertex order and does so in several of his other tutorials also. He did stick in a CullMode = none, but taking that out, as he states, doesn't make a difference.

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
633331
• Total Posts
3011390
• ### Who's Online (See full list)

There are no registered users currently online

×