Russell Suter (russell++at++symsystems.com)
Mon, 12 Jul 1999 13:11:10 -0600
It appears that pfNodeIsectSegs returns at most one hit structure per
segment. Is this true??? Does it return only the first hit it finds
in the node tree???
I'm asking because I have cases in my scene where a segment will
intersect
in more than one place but only one hit is returned. I thought that
because the prototype is:
int pfNodeIsectSegs(pfNode *node, pfSegSet *segSet,
pfHit **hits[]);
that I could declare something like:
pfHit **hit [5];
and then check hit [i] [j] where i is the index of the line segment and
j is the index of the hit in the node graph. Unfortunately there is
never
more than one hit for each i.
This is a real problem for me because I have lots of point features in
my
scene that are not cut into the terrain and when I do the
pfNodeIsectSegs
for a point above one of these features, sometimes I get the intersect
with the feature (what I want) and other times I get the intersect of
the terrain (what I don't want).
My test code is as follows:
{
pfSegSet seg_set;
pfVec3 point;
pfVec3 normal;
pfHit **hit [2];
pfSetVec3
(
seg_set.segs [0].pos,
player->position->x,
player->position->y,
10000.0f
);
pfSetVec3 (seg_set.segs [0].dir, 0.0f, 0.0f, -1.0f);
seg_set.segs [0].length = 500000.0f;
seg_set.mode = PFTRAV_IS_PRIM | PFTRAV_IS_NORM | PFTRAV_IS_CULL_BACK;
seg_set.activeMask = 0x1;
seg_set.isectMask = PFUCOLLIDE_GROUND;
seg_set.bound = NULL; /* Bounding Box */
seg_set.userData = NULL; /* User data pointer */
seg_set.discFunc = NULL; /* Descriminator callback */
if (!pfNodeIsectSegs (shared->scene, &seg_set, hit))
*player->height = 0.0f;
pfQueryHit (*hit [0], PFQHIT_POINT, point);
pfQueryHit (*hit [0], PFQHIT_NORM, normal);
if (*hit [1])
{
pfQueryHit (*hit [1], PFQHIT_POINT, point);
pfQueryHit (*hit [1], PFQHIT_NORM, normal);
}
}
I can position the x,y point over a feature and I will always get *hit
[0]
which may be the feature or the terrain but I never seem to get *hit
[1].
Should I be getting *hit [1]????
TIA
-- Russ ____________________________________ ___________________________________ Though my eyes could see | Russell Suter I still was a blind man. | Voice : (303) 858-0085 x1262 Though my mind could think | Fax : (303) 858-4004 I still was a mad man. | Internet : russell++at++symsystems.com ____________________________________|___________________________________
This archive was generated by hypermail 2.0b2 on Mon Jul 12 1999 - 12:08:39 PDT