   Trogdor wants to translate along his local Z axis
  Okay, so here's the story, I've got this DirectX project and I need a static mesh (TROGDOR!!!!!) to translate along his local space Z axis. Trogdor's members are:D3DXMATRIX world; (his world transform matrix)D3DXVECTOR3 position;Trogdor only rotates around his local Y axis (no pitch or roll) and trogdor never leaves the XZ plane.i've already triedposition += D3DXVECTOR3(world._13, world._23, world._33); without good results   
  That vector you've extracted isn't the forward vector for a row-major matrix, it's for a column-major matrix (D3D uses row-major matrices).  What you want is this:position += D3DXVECTOR3(world._31, world._32, world._33); ;  Well you are deffinately on the right track, i forget which order DX matrices are though...have you tried 31,32,33 instead of 13,23,33?   ;  Okay, but trogdor still isn't moving rightTrogdor is only moving along the X=Z line on the plane... it's like the X and Z components of his look vector are always the same for some reason.   ;  lol, i found the problem this WAS my update code:D3DXMATRIX p;D3DXMatrixIdentity(&p);D3DXMatrixTranslation(&p, position.x, position.y, position.x);D3DXMatrixMultiply(&world, &world, &p);...i swear it's little things like that... that can frustrate you for HOURS!!!   ;Quote:Original post by MJPThat vector you've extracted isn't the forward vector for a row-major matrix, it's for a column-major matrix (D3D uses row-major matrices).  What you want is this:position += D3DXVECTOR3(world._31, world._32, world._33); AFAIK it makes no difference whether the matrix is row or column major when accessing it with 2 dimensional coordinates. Row and column major only describes in memory where the different elements are stored.For Matrix11 12 1321 22 2331 32 33Memory LayoutRow Major0 1 23 4 56 7 8Col Major0 3 61 4 72 5 8   ;Quote:Original post by bzroomQuote:Original post by MJPThat vector you've extracted isn't the forward vector for a row-major matrix, it's for a column-major matrix (D3D uses row-major matrices).  What you want is this:position += D3DXVECTOR3(world._31, world._32, world._33); AFAIK it makes no difference whether the matrix is row or column major when accessing it with 2 dimensional coordinates. Row and column major only describes in memory where the different elements are stored.For Matrix11 12 1321 22 2331 32 33Memory LayoutRow Major0 1 23 4 56 7 8Col Major0 3 61 4 72 5 8Memory layout is a completely unrelated issue.  That only affects how you store your matrix elements, and how you retrieve them.  In fact there's no requirement that you store matrix elements in any sort of sequential order at all...you could store them in a linked list if you want to.  The fact that most matrix classes store their elements sequentially is an implementation detail.  (Fun trivia: D3D and OGL matrices actually have the exact same layout in memory despite the former being row-major and the latter being column-major).Going further on the point, when you say you want element ._23 from a D3DXMATRIX you're not asking for the 7th float in a sequential area of memory.  You're asking for the element located in the second row and third column of a matrix.  The memory layout is irrelevent, what is relevent what you're looking for.  If you're looking for the "forward" vector in a matrix that represents a rotation, then the forward vector will be located in different elements depending on whether you're dealing with a column-major or row-major matrix.  In a row-major matrix the basis vectors will be located in the rows of the matrix, and in a column-major matrix they will be located in the columns.  ;Quote:Original post by MJPGoing further on the point, when you say you want element ._23 from a D3DXMATRIX you're not asking for the 7th float in a sequential area of memory.  You're asking for the element located in the second row and third column of a matrix.  I believe you made my point precisely.Thats why telling him that he needed _32 rather than _23 due to d3d "being row major" is incorrect. Row major indicates the index of the float, and since he's not using indices, it is as you said, irrelevant.He's asking for a specific element regardless of row or column major, therefor telling him to be mindful of the majorness is incorrect.   ;  he was incorrect to suggest that?it fixed the OP's issue...   ;Quote:Original post by Atrix256he was incorrect to suggest that?it fixed the OP's issue...The suggestion was right; it was just the terminology that was wrong. The elements needed to be switched not because D3D matrices are row-major, but because D3D uses row-vector notation.   