Liu Xiaoyan (liuxy++at++ihpc.nus.edu.sg)
Tue, 05 May 1998 18:09:16 +0800
In order to implement bounding box to bounding box collision
detection, my approach is by using a dummy vector to activate
the ISECT process, which in turn will activate the pre-isect callback
attached to each node. In this callback, "pfBox.contains ..."
is called to detect the collison between boxes. The infomation
for the object that is moving(like bbox, position etc.) are
stored in shared memory, this particular node is disabled for
ISECT.
What happens is that sometimes the pre-isect functions
is called , sometimes not and then called again. The "printf"
before the isect do print sth and ISECT masks are just correct.
It seems there are some magic area the ISECT process is dead.
*****************************************************
The code looks like:
group->setTravFuncs(PFTRAV_ISECT, box2boxHit, NULL);
group->setTravFuncs(PFTRAV_APP, printInfo, NULL);
group->setTravData(PFTRAV_ISECT, (void *)shared_ptr);
int printInfo(....)
{ print out ISECT mask value == 0xffff;
return PFTRAV_CONT;
}
int box2boxHit(pfTraverser *trav, void *data)
{
pfNode *node = trav->getNode();
printf("\n in Call back"); // doesn't come out every time
if (box1.contains(&box2) != PFIS_FALSE)
printf("\n *************************MAY HIT");
return PFTRAV_CONT;
}
// collision detection between objects, use a dummy line
// to initiate ISEC traversal, actual detection done in
// each node's pre-isect Callback.
pfSegSet segset;
pfHit **hits[32];
segset.mode = PFTRAV_IS_GSET;
segset.userData = (void *)NULL;
segset.activeMask = 1;
segset.isectMask = 0xffff;
segset.bound = (void *)NULL;
segset.discFunc = NULL;
segset.segs[0].dir.set(0.0f, 0.0f, 1.0f); // dummy vector
segset.segs[0].length = 100.0f;
printf("\n begin "); // always come out
(shared_ptr->scene)->isect(&segset, hits); // activate it
Thanks for any idea.
Liu
***********************************************************************
Liu Xiaoyan Institute of High Performance Computing
Data Visualisation Group http://www.ihpc.nus.edu.sg Tel:(65)7709267
***********************************************************************
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:22 PDT