0

I'm trying to extract a row from the world matrix to place into my forward vector which when called in the Update function will make the plane move forward. Currently I have this working but I access the members directly, is there a function that would automatically pull a row out of my matrix?

// [Skip this step first time through] Get the forward vector out of the world matrix and put it in m_vForwardVector
XMFLOAT4X4 f44;                                                         //create a 4x4 float
XMStoreFloat4x4(&f44, m_mWorldMatrix);                                  //pass the world matrix into the 4x4 float

 m_vForwardVector = XMVectorSet(f44._31, f44._32, f44._33, f44._34);    //pass the forward vector values from the world matrix into the forward vector
qTicTac
  • 21
  • 1

1 Answers1

2

I've worked it out, a lot simpler than I imagined aha

m_vForwardVector = (m_mWorldMatrix.r[2]);
qTicTac
  • 21
  • 1
  • You may want to take a look at the [SimpleMath](https://github.com/Microsoft/DirectXTK/wiki/SimpleMath) wrapper for DirectXMath. – Chuck Walbourn Oct 31 '17 at 16:46