Archived

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

shakazed

D3DXIntersect, converting to world coords

Recommended Posts

shakazed    138
Can I convert the intersection point returned by D3DXIntersect into world space coordinates anyhow? EDIT: Want to use the function to calculate the y coord for any given point on my terrain (which is a .x file). [edited by - shakazed on January 25, 2004 11:10:39 AM]

Share this post


Link to post
Share on other sites
shakazed    138
Ok, so I thought when passing D3DXIntersect pDist it would give me the distance along the ray where the collision took place, and then use this as my new y coord (add constant) for my mesh. But it doesn´t give me any values I can use in that manner. Any ideas?

Share this post


Link to post
Share on other sites
BIGPOPA    122

How to get intersection point returned by D3DXIntersect into world space coordinates ?

Step 1: WorldSpace ==>ModelSpace
you might have passed your RayStartPos in Model_Space coordonates.
like MyRayStart=MeshWorldMatrix*RayStart

Step 2: Intersection Test
passe your ray parametters in MeshWorldMatrix format to D3DXIntersect function.

Step 3 ModelSpace ===>WorldSpace
world space Intersection Point=Intersection Point * Mesh_InverseWorldMatrix.


Good Luck

Share this post


Link to post
Share on other sites
shakazed    138
Gaaah! Aren´t there any tutorials on how to do this? I´ve looked all over (atleast it feels like that). I just can´t get it working. Since I´m so stupid I really need a step by step tutorial that explains everything I guess there are other ways to do terrain following with .x files. I could really use some pointers.

[edited by - shakazed on January 26, 2004 9:33:31 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
translate your y vector by the same amout you''ve transformed your mesh.

Share this post


Link to post
Share on other sites