So basically this is a problem I've been having since forever. I implemented a Camera System, it works fine but somewhere around the center (0, 0, 0) of the world it doesn't work. Actually it works, but it always moves back at the position I was before. Like, if I'm at (1, 0, 0), walking forward will make me stay at (1, 0, 0), while moving backwards will not. The weird thing is that as said before it only happens there and if I'm moving forwards, backwards, left and right work perfectly!
That's how I do my Walking:
XMVECTOR D = XMVectorReplicate(d); XMVECTOR L = XMLoadFloat3(&m_LookDirection); XMVECTOR P = XMLoadFloat3(&m_Pos); XMStoreFloat3(&m_Pos, XMVectorMultiplyAdd(D, L, P));
My Strafing (Left to Right) is basically the same thing. I update my ViewMatrix like that:
XMVECTOR R = XMLoadFloat3(&m_Right); XMVECTOR U = XMLoadFloat3(&m_Up); XMVECTOR L = XMLoadFloat3(&m_Look); XMVECTOR P = XMLoadFloat3(&m_Pos); XMVECTOR WU = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); //Compute wuv vectors for camera space XMVECTOR w = XMVector3Normalize(XMVectorSubtract(L, P)); XMVECTOR u = XMVector3Normalize(XMVector3Cross(WU, w)); XMVECTOR v = XMVector3Cross(w, u); XMStoreFloat3(&m_LookDirection, w); XMStoreFloat3(&m_Right, u); XMStoreFloat3(&m_Up, v);
Then I fill in the ViewMatrix but that's unimportant.
Hope someone knows that basic mistake I'm doing!