Re: Picking

From: ZMan (news-replies_at_thezbuffer)
Date: 10/20/04


Date: Tue, 19 Oct 2004 19:42:30 -0700

Sorry no VB code....

However if you don't understand the principles from the algorithms then you
are not going to understand what all the code is doing as its going to look
just the same as the algorithm.

Since you don't have a mesh I will assume your plane is made up of 2
triangles that you know the coordinates of.

Take the x,y position of the mouse and multiply by the inverse of the
projection matrix, the inverse of the view matrix.
If you have a world matrix for each object you will then have to multiply by
the inverse of that for your plane - if not then you are working in world
coordinates so you can miss this step.

Then for each triangle call IntersectTri to see if it hits. See my other
thread in this group for an explanation on how the hit location works.

>From reading this list I would think that c# is in the majority - it would
help if you can learn to read C & C++ as most DirectX resources are in those
languages.

If thats not enough let us know how far you have got and we can help from
there.

ZMan

"vbDev" <vbDev@discussions.microsoft.com> wrote in message
news:1A13B506-B929-42C7-9056-5304F3F526A5@microsoft.com...
> Please help. I'm a VB.NET developer and I can't figure out picking ..
> I've
> seen several people explain the algorithm but its just not clicking in. I
> think it would greately benifit me to see some code so I can tinker around
> with it and try to understand it better.
>
> All code I see is in C++ though and that does me no good. The main reason
> I'm having so much problem is because I'm not trying to see if a mesh or
> anything is clicked. I've got a flat plane primitive that I just need to
> see
> where it was clicked on (what location) Its in a 3D world so it is at an
> angle and everything.
>
> I've looked around and found nothing;
> If you have any references, you'd make me very happy :)