pfuCollide(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages
NAME
pfuCollisionChan, pfuGetCollisionChan, pfuCollideSetup, pfuCollideGrnd,
pfuCollideObj, pfuCollideGrndObj - Terrain following and collision
routines.
FUNCTION SPECIFICATION
#include <Performer/pfutil.h>
void pfuCollisionChan(pfChannel *chan);
pfChannel * pfuGetCollisionChan(void);
void pfuCollideSetup(pfNode *node, int mode, int mask);
int pfuCollideGrnd(pfCoord *coord, pfNode *node, pfVec3 zpr);
int pfuCollideObj(pfSeg *seg, pfNode *objNode, pfVec3 hitPos,
pfVec3 hitNorm);
int pfuCollideGrndObj(pfCoord *coord, pfNode *grndNode,
pfVec3 zpr, pfSeg *seg, pfNode *objNode, pfVec3 hitPos,
pfVec3 hitNorm);
DESCRIPTION
This collection of simple routines provides intersection traversals for
basic collision detection and ground following. Examples of pfuCollide
usage can be found in the OpenGL Performer transformation utility,
pfuXformer.
pfuCollisionChan sets the channel from which to derive LOD scale and
viewing information. This is used to determine which LOD to collide
against.
pfuGetCollisionChan returns the current channel set by pfuCollisionChan.
pfuCollideSetup sets the intersection mask of the subgraph rooted by node
to mask. The values mask can take are the same as in pfNodeTravMask. mode
is either
PFUCOLLIDE_STATIC
Geometry below node is considered static and intersection
caching will be enabled (see pfNodeTravMask) or
PFUCOLLIDE_DYNAMIC
Geometry below node is considered dynamic and intersection
caching will not be enabled (see pfNodeTravMask)
Best intersection performance is achieved for static geometry.
pfuCollideGrnd fires a ray downward (in negative Z direction) from coord
and returns PFUCOLLIDE_GROUND if an intersection was found with the
subgraph rooted by node and FALSE otherwise. The height and orientation
Page 1
pfuCollide(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages
of the intersected geometry is returned in zpr which contains the height,
and the pitch and roll angles of the surface at the intersection point.
pfuCollideObj intersects seg with the subgraph rooted by objNode and
returns PFUCOLLIDE_OBJECT if an intersection was found and FALSE
otherwise. The intersection point and surface normal is returned in
hitPos and hitNorm respectively. seg is typically a velocity vector used
to detect collisions in the direction of travel.
pfuCollideGrndObj is the combination of pfuCollideObj and pfuCollideGrnd.
It may provide better performance over calling these routines separately
when grndNode and objNode are identical. The return value is a bitmask
of PFUCOLLIDE_GROUND and PFUCOLLIDE_OBJECT indicating whether the
downward-directed ray and/or the line segment hit anything.
NOTES
The libpfutil source code, object code and documentation are provided as
unsupported software. Routines are subject to change in future releases.
SEE ALSO
pfHit, pfNode, pfNodeIsectSegs, pfNodeTravMask
Page 2