Original Post
Hi all, i ran into a new problem with my ray picker. Normal source : This works nicely for a "*LEFT HAND" system, but how would i change it, to work in a "*RIGHT HAND" system ? *LEFT HAND = D3DXMatrixLookAtLH + D3DXMatrixPerspectiveFovLH *RIGHT HAND = D3DXMatrixLookAtRH + D3DXMatrixPerspectiveFovRH
void calcRay(int x,int y,D3DVECTOR &p1,D3DVECTOR &p2)
{
float dx,dy;
D3DMATRIX invMatrix,viewMatrix;
dx=tanf(FOV*0.5f)*(x/WIDTH_DIV_2-1.0f)/ASPECT;
dy=tanf(FOV*0.5f)*(1.0f-y/HEIGHT_DIV_2);
lpDevice->GetTransform(D3DTRANSFORMSTATE_VIEW,&viewMatrix);
D3DMath_MatrixInvert(invMatrix,viewMatrix);
p1=D3DVECTOR(dx*NEAR,dy*NEAR,NEAR);
p2=D3DVECTOR(dx*FAR,dy*FAR,FAR);
D3DMath_VectorMatrixMultiply(p1,p1,invMatrix);
D3DMath_VectorMatrixMultiply(p2,p2,invMatrix);
}
