Jump to content
  • Advertisement

Archived

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

shakazed

D3DXIntersect, converting to world coords

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

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
Advertisement
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

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
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
translate your y vector by the same amout you''ve transformed your mesh.

Share this post


Link to post
Share on other sites

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