# 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...
> 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 :)

## Relevant Pages

• Re: Collision of convex polyeders
... I want to implement a collision detection algorithm. ... It seems easy to find out wheter there is a plane in 3D going through ... Collision detection means looking for the intersections between the 4D ...
(comp.graphics.algorithms)
• Re: Clip aligned box with a half-space and bound again
... After a night's sleep I realized that the resulting algorithm is ... The plane divides the box into two pieces C and D. Let e_k be the ... that dimension is the one to which the plane is the most orthogonal to. ... had before (before I traced the minimum and maximum distance _points_, ...
(comp.graphics.algorithms)
• linear algebra: help needed w/ counting algorithm
... I'm trying to find an algorithm that can enumerate/count vectors of an ... the algorithm can be seeded with: ... not lie on the x-y or y-z or x-z plane. ... maxInt and the K = desired set size? ...
(sci.math)
• linear algebra: help needed w/ counting algorithm
... I'm trying to find an algorithm that can enumerate/count vectors of an ... the algorithm can be seeded with: ... not lie on the x-y or y-z or x-z plane. ... maxInt and the K = desired set size? ...
(sci.crypt)
• Re: Picking
... Thanks a lot ZMan, I got the logic implimeneted and its actually returning ... > the inverse of that for your plane - if not then you are working in world ... > thread in this group for an explanation on how the hit location works. ... >> seen several people explain the algorithm but its just not clicking in. ...
(microsoft.public.win32.programmer.directx.managed)