Jump to content
  • Advertisement
Sign in to follow this  

inversing a matrix in d3d

This topic is 3460 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

i am reading a tut online and it says , when you inverse the viewmatrix , the result becomes the world matrix?

Share this post

Link to post
Share on other sites

The view matrix transforms points from world space to view (eye/camera) space. The inverse of the view matrix will undo that same transformation, that is, transform points from view space to world space.

Share this post

Link to post
Share on other sites
They might have meant that the inverse of the view matrix will, in general, be the world (model) matrix for the object with which the virtual camera is associated (provided there is such an object). But to simply say that 'the inverse of the view matrix is the world matrix' doesn't make much sense.

Share this post

Link to post
Share on other sites
so this is my picking function to get the cursor in to the world matrix,

void Pick(D3DXMATRIX View,D3DXMATRIX matProj)
POINT point;
RECT rect;

HWND D3DWin = FindWindow(NULL,"Our Direct3D Program");

float w = (float)rect.right;
float h = (float)rect.bottom;

float x = (2.0f*point.x/w - 1.0f) / matProj(0,0);
float y = (-2.0f*point.y/h + 1.0f) / matProj(1,1);

D3DXVECTOR3 origin(0.0f,0.0f,0.0f);
D3DXVECTOR3 dir(x,y,1.0f);


D3DXVECTOR3 originW;
D3DXVec3TransformCoord(&originW, &origin,&invView);


can anyone tell me if i am on the right path

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!