picking in dx
can anyone show me a sample on how to pick in directx? i just tried picking a mesh since dx has its build in function for testing a ray and a mesh.. but i dont knw how to perform picking in an ordinary polygon like for example a triangle
Calculate the ray through the camera and the mousecursor position on the front plane, then do a simple ray-triangle intersection.
Hiya dxdotnet1, How are you doing bud?
[The Problem]
picking in DX
[The Solution]
Just to extend on what the other guys have posted already. Here is a simple description of picking and how to achieve it in theory.
Picking My Terrain
I hope this helps a bit bud,
Keep cool.
[The Problem]
picking in DX
[The Solution]
Just to extend on what the other guys have posted already. Here is a simple description of picking and how to achieve it in theory.
Picking My Terrain
I hope this helps a bit bud,
Keep cool.
I noticed your name was called dotnet...so in case you are using managed direct X (or have access to it) there is an intersection test function within D3dX namespace to test against a triangle, and also various bounding volumes. You could also take a look at the code to those functions for some inspiration. When I do picking on the terrain in my current project, I create a ray using the pointer location and near plane in the view frustrum and then check for intersection with the triangles within my viewport. Determining which polys are in the viewport is a whole different ball of wax for sure, but since intersection tests can be costly on the cpu you might want to trivial reject these.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement