SIM_Collider Class Reference

#include <SIM_Collider.h>

Inheritance diagram for SIM_Collider:

SIM_Data SIM_OptionsUser RBD_ColliderSDF SIM_ColliderBFA SIM_ColliderNone SIM_ColliderPoint RBD_ColliderBFA

List of all members.

Public Types

enum  SIM_ImpactApplyType { SIM_IMPACTAPPLY_NONE, SIM_IMPACTAPPLY_ONEWAY, SIM_IMPACTAPPLY_MUTUAL, SIM_IMPACTAPPLY_FEEDBACK }
 Defines the possible affector types when doing collision detection. More...

Public Member Functions

 GETSET_DATA_FUNCS_B (SIM_NAME_REVERSEOBJECTROLES, ReverseObjectRoles)
bool collideObjects (SIM_Engine &engine, SIM_Object &object, SIM_Object &affector, const SIM_Time &starttime, const SIM_Time &endtime, SIM_ImpactApplyType impactapplytype, int impactflags) const

Protected Member Functions

 SIM_Collider (const SIM_DataFactory *factory)
 The SIM_Collider constructor.
virtual ~SIM_Collider ()
 The SIM_Collider destructor.
SIM_ImpactsgetObjectImpactData (SIM_Object &object, SIM_ImpactApplyType impactapplytype) const
SIM_ImpactsgetAffectorImpactData (SIM_Object &affector, SIM_ImpactApplyType impactapplytype) const
bool getAffectorInterpolatedToEndTime () const
virtual bool collideObjectsSubclass (SIM_Engine &engine, SIM_Object &object, SIM_Object &affector, const SIM_Time &starttime, const SIM_Time &endtime, SIM_ImpactApplyType impactapplytype, int impactflags) const
virtual bool getAffectorInterpolatedToEndTimeSubclass () const


Detailed Description

This is an abstract base class for all colliders. A collider is any class that takes a pair of objects and generated information about how those two objects intersect. See the SIM_Object::getCollider() function for a description of how a solver should determine the right SIM_Collider class to use for a given pair of objects.

Definition at line 31 of file SIM_Collider.h.


Member Enumeration Documentation

Defines the possible affector types when doing collision detection.

Enumerator:
SIM_IMPACTAPPLY_NONE 
SIM_IMPACTAPPLY_ONEWAY  Don't do any collision detection.
SIM_IMPACTAPPLY_MUTUAL  Object A gets Impacts from object B.
SIM_IMPACTAPPLY_FEEDBACK  Object A and B both get Impacts.

Object A gets Impacts, B gets Feedback.

Definition at line 53 of file SIM_Collider.h.


Constructor & Destructor Documentation

SIM_Collider::SIM_Collider ( const SIM_DataFactory factory  )  [explicit, protected]

The SIM_Collider constructor.

virtual SIM_Collider::~SIM_Collider (  )  [protected, virtual]

The SIM_Collider destructor.


Member Function Documentation

bool SIM_Collider::collideObjects ( SIM_Engine engine,
SIM_Object object,
SIM_Object affector,
const SIM_Time starttime,
const SIM_Time endtime,
SIM_ImpactApplyType  impactapplytype,
int  impactflags 
) const

Perform the collision detection for a pair of objects. This function calls the collideObjectsSubclass() function. This also attempts to do collision response.

virtual bool SIM_Collider::collideObjectsSubclass ( SIM_Engine engine,
SIM_Object object,
SIM_Object affector,
const SIM_Time starttime,
const SIM_Time endtime,
SIM_ImpactApplyType  impactapplytype,
int  impactflags 
) const [protected, virtual]

Override this method to implement your custom collision detection. This function can access any data on the main object or affector object. It can also add any extra data structures it needs to the object for efficiency (rather than recalculating the extra data each time this function is called).

Reimplemented in RBD_ColliderSDF, SIM_ColliderNone, and SIM_ColliderPoint.

SIM_Impacts* SIM_Collider::getAffectorImpactData ( SIM_Object affector,
SIM_ImpactApplyType  impactapplytype 
) const [protected]

Finds or creates the impact data on the affector that is appropriate for the given affector type. It also takes into account the value of the ReverseObjectRoles flag.

bool SIM_Collider::getAffectorInterpolatedToEndTime (  )  const [protected]

Returns true if the collideObjects function should always be called with the affector object interpolated to the endtime. This function just calls getAffectorInterpolatedToEndTimeSubclass().

virtual bool SIM_Collider::getAffectorInterpolatedToEndTimeSubclass (  )  const [protected, virtual]

Returns true if the collideObjects function should always be called with the affector object interpolated to the endtime. The default implementation returns true.

Reimplemented in SIM_ColliderNone.

SIM_Impacts* SIM_Collider::getObjectImpactData ( SIM_Object object,
SIM_ImpactApplyType  impactapplytype 
) const [protected]

Finds or creates the impact data on the affector that is appropriate for the given affector type. It also takes into account the value of the ReverseObjectRoles flag.

SIM_Collider::GETSET_DATA_FUNCS_B ( SIM_NAME_REVERSEOBJECTROLES  ,
ReverseObjectRoles   
)

Specifies whether the object and affector need to be reversed to perform collision detection. This flag is useful for colliders that make assumptions about the makeup of the object and affector are in the call to collideObjectsSubclass(). For example, the point collider (SIM_ColliderPoint) always treats the object as a particle system, using ray casting to follow the trajectory of each particle. But suppose an RBD Solver has a particle system as an affector object. The RBD Solver would find that the best collider to use is a point collider. Rather than requiring that the RBD Solver then somehow discover that the particle object must always be sent as the "object" parameter, the collider can have the reverse object roles flag turned on. Then when the RBD Solver calls the collider with the RBD object first and the particle object second, the collider itself will reverse the objects before passing them on to collideObjectSubclass().


The documentation for this class was generated from the following file:

Generated on Fri May 25 00:10:37 2012 for HDK by  doxygen 1.5.9