Advertisement Jump to content
Sign in to follow this  
Phillip Hamlyn

Mesh Picking - Problem Solved, Might Be Of Interest

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

All, I posted a couple of times a few months ago about my mesh picking being inaccurate. I tried all the samples posted (and some sent by email - thanks) but although my logic was correct using mesh intersect in Dx9 my intersect was always 'out' by a significant and visible amount. My world matrix was identity so I wasn't having the usual trouble of not translating my ray etc.etc. Anyhoo I stumbled on the solution late, late one coffee fuelled night quite by accident. It might be Dx9 only but here goes; My Front Plane on my view frustum was set as "1" which was Ok, but it seems that the mesh.intersect function doesn't work very accurately unless your front plane is significantly higher amount. I set mine to 10 and suddenly my mesh picking worked accurately without needing any other code changes. Ive replicated this fix a couple of times and indeed, the closer I pull the front pane to the eye location the more inaccurate the mesh picking becomes. I suspect a floating point arithmetic problem is at work here. I just thought I'd post this for posterity in the hope of giving back so some poor unfortunate like me whose banging their head against a brick wall... Phillip Hamlyn.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!