IKCPathCollisionDetector(64) Interface
- Detect
- GetCollidedObjects
IKCPathCollisionDetector provides access to Collision Detector, which
implements
Path Collision Detection functionality.
See also: Collision Path
sample
HRESULT Detect(PathDetectorContext* context, double* tCollision)
Parameters
context - [in] additional parameters
for the operation or NULL.
context.decreasingStart member affects only performance of the
method. Set context.decreasingStart to true if it is known that
the on the start of movement distance between the objects decreases (but may
have some increasing stages later during the movement). Default: false
context.minDistToler - If minimal distance between the
objects is less than this value it is assumed that it a collision has happened. If
this member is set to zero or a negative number a default tolerance is used,
which is calculated from geometry of the objects and depends on how fine surface
approximation is.
context.precision - not used in this release
If context is NULL defaults are used
tCollision - [out, retval] the returned parameter
from range [0, 1] at which
the collision occurred or large number (greater than 2) if no collision was
detected
-
- Remarks:
This method assumes that a set of objects and their movements have been added
to the collision detector using IKinematicSet_KC.AddObject
where IKinematicSet_KC was queried from this
IKCPathCollisionDetector
If the returned value tCollision is greater or equal
to 0 and less than or equal to 1 it is the parameter of the collision moment.
Otherwise there where no collision detected.
Use IKinematicSet_KC.SetPosition(tCollision) to
move all added objects to the collision situation. After that
IMetrics.Dist
can be used to obtain extended information about nearest points at collision
situation.
HRESULT GetCollidedObjects( IMetrics** object0, IMetrics** object1 )
Parameters
object0 - [out]
IMetrics implemented by the first object of
the collided pair
object1 - [out]
IMetrics implemented by the second object of
the collided pair
- Remarks:
The methods is useful only for multi object collision detection. It
identifies which objects have actually collided. The retuned references are
NULL if there where no collision or Detect
method has not been called yet.
If there was a multiple objects collision at the same time selection of the
collided pair should be considered random.
|