Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualL. Spiro

Posted 31 January 2013 - 07:05 AM

I expected as much but I did not want to overload you.

Also you need to normalize the direction vector, which means you should store it in a temporary.  This helps with debugging anyway, which is a skill you need to be a good developer in the first place.

 

I expect you have yet another problem which is much more complicated to explain.

Are you drawing the target object with a world matrix other than identity?

If so you need to translate the ray into the frame-of-reference of that object (and each object in your scene when you have more than one) before doing the ray cast.

 

That means translating the ray’s position by the inverse world matrix of each object, and translating the ray’s direction vector by the inverse transpose of the inverse world matrix.

 

 

L. Spiro


#1L. Spiro

Posted 31 January 2013 - 07:02 AM

I expected as much but I did not want to overload you.

 

I expect you have yet another problem which is much more complicated to explain.

Are you drawing the target object with a world matrix other than identity?

If so you need to translate the ray into the frame-of-reference of that object (and each object in your scene when you have more than one) before doing the ray cast.

 

That means translating the ray’s position by the inverse world matrix of each object, and translating the ray’s direction vector by the inverse transpose of the inverse world matrix.

 

 

L. Spiro


PARTNERS