1

I'm using XNA (which uses DirectX) for some graphical programming. I had a box rotating around a point, but the rotations are a bit odd.

Everything seems like someone took a compass and rotated it 180 degrees, so that N is 180, W is 90, etc..

I can't quite seem to find a source that states the orientation, so i'm probably just not using the right keywords.

Can someone help me find what XNA/DirectX's orientation is, and a page that states this too?

MintyAnt
  • 2,978
  • 7
  • 25
  • 37

1 Answers1

8

DirectX uses a left-handed coordinate system.

XNA Uses a right-handed coordinate system.

  • Forward is -Z, backward is +Z. Forward points into the screen.
  • Right is +X, left is -X. Right points to the right-side of the screen.
  • Up is +Y, down is -Y. Up points to the top of the screen.

Matrix layout is as follows (using an identity matrix in this example). XNA uses a row layout for its matrices. The first three rows represent orientation. The last row and first three columns ([4, 1], [4, 2], and [4, 3]) represent translation/position. Here is documentation on XNA's Matrix Structure.

In the case of a translation matrix (translation is position and rotation combined):

Right     1   0   0   0

Up        0   1   0   0

Forward   0   0   -1   0

Pos       0   0   0   1
Nic Foster
  • 2,864
  • 1
  • 27
  • 45
  • 1
    I found this ancient post, but am still puzzled as to why XNA.Vector3.Forward returns me "0,0,-1". Any idea why this might be since a RHC system should be 0,0,1 as your matrix shows. – PhillipH Jul 23 '14 at 12:28
  • Phillip, the forward IS 0, 0, -1, my post had a typo that nobody ever mentioned. – Nic Foster Jul 25 '14 at 19:07