Jump to content
  • Advertisement

Archived

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

Tagamoga

ViewMatrix

This topic is 5781 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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, column

float cameraY = matCamera(3, 1);
float cameraZ = matCamera(3, 2);

Share this post


Link to post
Share on other sites
@Anonymous Poster #1
Even in your Cameraclass you have to track your CameraPosition

@Anonymous Poster #2
Thanks, now I have got, what I need, and it is working! ~g~

Taggi

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!