• Advertisement
Sign in to follow this  

picking problem

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

guys help me see i have a 3d terrain composed of tiles and my tile picking works well. my only problem is when i add a 3d model in my terrain i cant pick the model properly. well i draw all the terrain first using 3d tile then drawn all visible 3d models. See the problem is when i drawn the model lets say for example at 16,0,-128 and pick at the model it doesnt picked. but when i click on the first tile ( tile 0 located at 0,0,0) my message box says that i picked the model. whats wrong? when do i need to reset my world matrix? or do i really need to reset my world matrix when drawing someting?

Share this post


Link to post
Share on other sites
Advertisement
I cant pick my mesh properly after a series of transform :(
pls help! it picks right when the mesh is untransformed.

Share this post


Link to post
Share on other sites
Could you post your code?
A good solution for ray picking is the use of D3DXIntersect and D3DXVec3Unproject function.
With the second, you transform a screen point to the space coordinates (remember that the input coordinates should be in viewport coordinates): notes that the pWorld matrix must the trasformation matrix of the mesh.
Using D3DXVec3Unproject you obtain the first D3DXVECTOR for D3DXIntersect: with the second you will "create" a ray and if it's intersect the mesh, last function return true value.

Share this post


Link to post
Share on other sites
thanks but i already found the solution, i transform my ray from world to model and test it against model coordinate of my mesh. :)

Share this post


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

  • Advertisement