From: Jason Daly (jdaly++at++ist.ucf.edu)
Date: 04/13/2005 07:08:38
Denis Mohnhaupt wrote:
>hello,
>
>i have an application with self-generated terrain (vertex values are in
>world coordinates, no transformations) and want to place objects on it. so i
>have to do a ray intersection, where the user point's with the mouse, to
>achieve the exact point of the intersection.
>
>i found out, that i can achieve this by
>pfHit ** pfvPicker::getPickList();
>
>so i get the pointer to an array of hit objects
>the first (and actual only) entry is my nearest hit, and thus the thing i
>want. pfHit has a member "pfVec3 point;" but it is protected.
>there are no methods to read out it's value, so how can i access this
>information?
>
>
I just reread the man page for pfHit (it's been a while), and I realized
that it's a bit confusing, so I thought I'd give you a little more help :-)
First, you have to check whether the pfHit object has the information
you want (the point of intersection, in this case), then you can query
for the information. The code snippet below should help:
// Query for the intersection's valid flags
(hits[0])->query(PFQHIT_FLAGS, &flags);
// See if the point of intersection is valid
if (flags & PFHIT_POINT)
{
pfVec3 point;
// Get the point of intersection
(hits[0])->query(PFQHIT_POINT, &point);
}
Other information (such as the normal and the world-to-local transform)
can be retrieved in a similar way. Check the flags first, then do the
appropriate query.
Hope this helps...
----"J"
"I'm a castaway stranded in a desolate land, I can see the footprints in the virtual sand." --Neil Peart
This archive was generated by hypermail 2b29 : Wed Apr 13 2005 - 07:08:49 PDT