- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# col::Callback Struct Reference

This is a functor for collision callbacks. More...

Collaboration diagram for col::Callback:

[legend]
List of all members.

## Public Member Functions
virtual void | operator() (const Data *data)=0 throw ()
| The raison d'etre; this will be executed by the coll. det. module.
| Callback (osg::NodePtr obj1, osg::NodePtr obj2, bool always=false, bool all_polygons_in=false, LevelOfDetectionE level_of_detection=LEVEL_EXACT)
| Create a collision callback functor.
## Public Attributes
osg::NodePtr | obj1
| The two objects participating in the collision (or non-collision).
osg::NodePtr | obj2
bool | collision
| Tells whether or not obj1/2 have collided.
bool | all_polygons
| Tells whether or not the application is interested in all pairs of intersecting polygons.
LevelOfDetectionE | level
| Level of detection.

## Detailed Description

This is a functor for collision callbacks.

Clients of the collision detection module need to derive from this abstract class and overload the () operator.

A callback can be a collision callback or a cycle callback. Collision callbacks are invoked in case of collision, cycle callbacks are invoked at the end of a completed collision cycle. Collision callbacks are only called if one or both of the objects have moved. Cycle callbacks are only called if there has been at least one object which has moved since the last cycle. Collision callbacks get some collision data (see struct Data), cycle callbacks don't.

Author:
  Gabriel Zachmann

Todo:
  - Option vorsehen, so dass callbacks auch aufgerufen werden, wenn keines der beiden Objekte sich bewegt hat.
  - Maybe we need an additional class of Callbacks, which can be re-used for several object pairs; this would just mean, that obj1/obj2 would be overwritten by the coll.det. module for every callback actually performed.

## Constructor & Destructor Documentation

col::Callback::Callback | ( | osg::NodePtr | inobj1,
|  | osg::NodePtr | inobj2,
|  | bool | always = `false`,
|  | bool | all_polygons_in = `false`,
|  | LevelOfDetectionE | level_of_detection = `LEVEL_EXACT` |
| ) |  |  |

Create a collision callback functor.

Parameters:

  | inobj1/inobj2 | callback for this pair of objs is created (both should be NullNode, if cycle callback)
  | all_polygons_in,always | flags (see below)
  | level_of_detection | the maximum level of detection (box, convex hull, or exact) wanted for this particular callback; the cell will later perform the max of all levels.

If all_polygons = true, then the col.det. module will report all pairs of intersecting polygons.

If always = true, then the col.det. module will call the callback once every collision cycle, whether the objects are colliding or not.

If the callback will be registered as a cycle callback, then both obj1 and obj2 should be a NullNode. Otherwise, both obj1 and obj2 must not be a NullNode; however, this will be checked only when the callback is actually saved in the collision matrix!

Todo:
  always flag verarbeiten.

## Member Data Documentation

LevelOfDetectionE col::Callback::level

Level of detection.

The coll. det. module might choose to check with a finer level (for instance, if another callback for the same pair requests it).

If all_polygons are requested, then the finest level is assumed automatically.

The documentation for this struct was generated from the following files:

- Collision.h
- Collision.cpp