This topic is now archived and is closed to further replies.

Wicked Ewok

How do you extract a View Camera Position relative to the World

Recommended Posts

Wicked Ewok    144
I need to extract the current camera position. Below is how I transform the View Matrix so that I can mouse look, zoom, strafe, etc. //I set up my camera once with an up vector: D3DXMatrixLookAtLH(&matView, &gCameraPosition, &gLookAtPosition, &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); //Now for mouse look I multiply the current matrix(matView) by a rotation matrix //that has the rotational angles already D3DXMatrixMultiply(&matView, &matView, &matRotate); pd3dDevice->SetTransform(D3DTS_VIEW, &matView); //for movement, I multiply the current View matrix by a transform matrix and set it: D3DXMatrixMultiply(&matView, &matView, &matTransform); pd3dDevice->SetTransform(D3DTS_VIEW, &matView); Ok, now all I have is the static matView that is updated everytime, then set as the View matrix. How do I extract a 3D position from that matrix? Can I? Simple question I think, still clueless though. Thanks! -=~''''^''''~=-.,_Wicked_,.-=~''''^''''~=-

Share this post

Link to post
Share on other sites