How to Do Pick?

Started by
2 comments, last by ericsk 20 years, 8 months ago
Hi all, I have a problem with doing pick.
I have a X file and it contains a scene.(many buildings)

What I want to do is that to click on somewhere
on the screen, my application may detect which
building it hit.
According to the sample provided by DirectX Documentation,
it may detect the MESH, but I want to detect FRAME....

Would you please do me a favor? Tell me how can I do? Thx Eric L.C. Shang-kuan
--Eric L.C. Shang-kuan<eric@tfcis.org>
Advertisement
You should spread your houses to different meshes so that you can detect it per mesh
in my scene model. every building is a frame hierachy. whcih contains many small meshs. I want to be able to pick every building. Is there any better way to do picking than checking every small mesh from these buildings? thanks~
build a ray from your camera position, your camera matrix and the screen position of your mouse pointer. have bounding spheres or boxes of all houses precalculated. then just loop through them, intersect the ray with each and see which it hits first. that''s your house.

This topic is closed to new replies.

Advertisement