#### Archived

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

# 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.

## 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 on other sites
In Other words, how Do I find out or trace the camera Position?

Taggi

##### Share on other sites
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 on other sites
Thanks, but how do I access the single Members of a D3DXMATRIX-object?

Taggi

##### Share on other sites
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 on other sites
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);

##### Share on other sites
@Anonymous Poster #1

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

Taggi

1. 1
Rutin
43
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633399
• Total Posts
3011663
• ### Who's Online (See full list)

There are no registered users currently online

×