ViewMatrix
Hello...
It''s me again... *g*
I have made a little progress ...
I am moving my great super triangle around... *s* I am using Transaltion Matrices and Rotation Matrices and everything is working just fine...
But now there is something like collision tests. For Example I don''t want my camera to drop beneath the x-y-plane. That mean the the z-part of my KameraVector must not be negative...
But how do I find out, with only the ViewMatrix, which is the Kameravektor. Is there any function I have overlooked?
Is there something similar for the Upvector and viewpoint?
Taggi
if you''re talking about a first-person point-of-view camera, then i believe that the camera matrix can be found from the inverse of the view matrix. for a DX-style LH matrix that would mean the camera''s position (x, y, z) would be found in the 41, 42, and 43 members of the matrix.
make a class called Camera
make 3 member variables.
for eye point, look at point, and up vec.
the eye point variable will be your cameras position.
make 3 member variables.
for eye point, look at point, and up vec.
the eye point variable will be your cameras position.
D3DXMATRIX is just a struct. each matrix element is either accessed as in a two dimensional array, or directly:
D3DXMATRIX matCamera;D3DXMatrixInverse(&matCamera, NULL, &m_matView);float cameraX = matCamera._41;float cameraY = matCamera._42;float cameraZ = matCamera._43;// or...float cameraX = matCamera(3, 0); // zero-based, row, columnfloat cameraY = matCamera(3, 1);float cameraZ = matCamera(3, 2);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement