D3DXIntersect, converting to world coords
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]
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?
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
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]
[edited by - shakazed on January 26, 2004 9:33:31 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement