Archived

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

ericsk

How to Do Pick?

Recommended Posts

ericsk    122
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

Share this post


Link to post
Share on other sites
Likevin    122
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~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites