Impact Interaction System API
Impact.Triggers.ImpactTriggerBase< TCollision, TContact > Class Template Reference

A base class for implementing Impact Triggers. It is not necessary to inherit from this class when making your own trigger, but it contains methods and properties you might find useful.

Template Parameters
TCollisionThe IImpactCollisionWrapper implementation being used.
TContactThe IImpactContactPoint implementation being used.
More...

Inheritance diagram for Impact.Triggers.ImpactTriggerBase< TCollision, TContact >:
Impact.Triggers.IImpactTrigger Impact.Triggers.ImpactCollisionTriggerBase< TCollision, TContact > Impact.Triggers.ImpactSlideAndRollTriggerBase< TCollision, TContact > Impact.Triggers.ImpactSpeculativeCollisionTriggerBase< TCollision, TContact >

Protected Member Functions

IImpactObject getImpactObject (GameObject collider)
 Attempts to retrieve an IImpactObject to send interaction data to. If MainTarget is set, MainTarget will be returned. Otherwise it will attempt to get the IImpactObject component from the given game object or one of its parents. More...
 
void processCollision (TCollision collision)
 Takes the given IImpactCollisionWrapper and processes it based on the trigger settings. Override buildAndSendCollisionParameters to receive the built data and convert it to IInteractionData to send to an IImpactObject. More...
 
void processCollisionSingleContact (TCollision collision)
 Takes the given IImpactCollisionWrapper and processes it for a single contact only (the first contact). Override buildAndSendCollisionParameters to receive the data and convert it to IInteractionData to send to an IImpactObject. More...
 
void processCollisionSingleAveragedContact (TCollision collision)
 Takes the given IImpactCollisionWrapper and processes it for a single averaged contact. Override buildAndSendCollisionParameters to receive the data and convert it to IInteractionData to send to an IImpactObject. More...
 
void processCollisionMultipleContacts (TCollision collision)
 Takes the given IImpactCollisionWrapper and processes all of it's contact points. Override buildAndSendCollisionParameters to receive the data and convert it to IInteractionData to send to an IImpactObject. More...
 
void processCollisionContact (TCollision collision, TContact contactPoint)
 Process a collision contact to get all material and velocity data. The material and velocity data will be sent to buildInteractionData, which you can override. More...
 
ImpactTagMaskgetOtherObjectTagMask (IImpactObject impactObject, Vector3 point, int otherPhysicsMaterialID, bool hasOtherObject)
 
virtual void buildInteractionData (IImpactObject target, TCollision collision, TContact contactPoint, VelocityData myVelocityData, VelocityData otherVelocityData, ImpactTagMask? tagMask, float compositionValue)
 Called by the process methods to build IInteractionData. Override this if your custom triggers are using any of the process methods. More...
 
void invokeTriggeredEvent (InteractionData interactionData, IImpactObject impactObject)
 

Properties

bool Enabled [get, set]
 Should this trigger process any collisions? You should use this instead of the normal enabled property because collision messages are still sent to disabled components. More...
 
ImpactObjectBase MainTarget [get, set]
 The ImpactObjectBase this trigger will use for interaction calculations. More...
 
bool UseMaterialComposition [get, set]
 Should this trigger use the material composition of the objects it hits? If true, interaction data will be sent for each material at the interaction point. If false, interaction data will only be sent for the primary material at the interaction point. More...
 
ImpactTriggerContactMode ContactMode [get, set]
 How collision contacts should be handled. More...
 
bool HighPriority [get, set]
 Should this trigger ignore the Physics Interactions Limit set in the Impact Manager? More...
 
- Properties inherited from Impact.Triggers.IImpactTrigger
bool Enabled [get, set]
 Should this trigger process any collisions? You should use this instead of the normal enabled property because collision messages are still sent to disabled components. More...
 
ImpactObjectBase MainTarget [get, set]
 The ImpactObjectBase this trigger will use for interaction calculations. More...
 
bool UseMaterialComposition [get, set]
 Should this trigger use the material composition of the objects it hits? If true, interaction data will be sent for each material at the interaction point. If false, interaction data will only be sent for the primary material at the interaction point. More...
 
ImpactTriggerContactMode ContactMode [get, set]
 How collision contacts should be handled. More...
 
bool HighPriority [get, set]
 Should this trigger ignore the Physics Interactions Limit set in the Impact Manager? More...
 

Events

Action< InteractionData, IImpactObjectOnTriggered
 Invoked when triggered. Sends the Interaction Data and the Impact Object that was triggered.
 

Detailed Description

A base class for implementing Impact Triggers. It is not necessary to inherit from this class when making your own trigger, but it contains methods and properties you might find useful.

Template Parameters
TCollisionThe IImpactCollisionWrapper implementation being used.
TContactThe IImpactContactPoint implementation being used.
Type Constraints
TCollision :IImpactCollisionWrapper<TContact> 
TContact :IImpactContactPoint 

Member Function Documentation

◆ buildInteractionData()

virtual void Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.buildInteractionData ( IImpactObject  target,
TCollision  collision,
TContact  contactPoint,
VelocityData  myVelocityData,
VelocityData  otherVelocityData,
ImpactTagMask tagMask,
float  compositionValue 
)
protectedvirtual

Called by the process methods to build IInteractionData. Override this if your custom triggers are using any of the process methods.

Parameters
targetThe target IImpactObject to send data to. You do not necessarily have to send data to this object.
collisionThe collision being processed.
contactPointThe collision contact point.
myVelocityDataThe velocity data of this object.
otherVelocityDataThe velocity data of the object being collided with.
tagMaskThe tag mask obtained from the other object. Can be null.
compositionValueThe material composition value.

Reimplemented in Impact.Triggers.ImpactCollisionTriggerBase< TCollision, TContact >, and Impact.Triggers.ImpactSlideAndRollTriggerBase< TCollision, TContact >.

◆ getImpactObject()

IImpactObject Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.getImpactObject ( GameObject  collider)
protected

Attempts to retrieve an IImpactObject to send interaction data to. If MainTarget is set, MainTarget will be returned. Otherwise it will attempt to get the IImpactObject component from the given game object or one of its parents.

Parameters
colliderThe game object to use if MainTarget is null.
Returns
The IImpactObject to send interaction data to, if one can be found.

◆ processCollision()

void Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.processCollision ( TCollision  collision)
protected

Takes the given IImpactCollisionWrapper and processes it based on the trigger settings. Override buildAndSendCollisionParameters to receive the built data and convert it to IInteractionData to send to an IImpactObject.

Parameters
collisionThe collision to process.

◆ processCollisionContact()

void Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.processCollisionContact ( TCollision  collision,
TContact  contactPoint 
)
protected

Process a collision contact to get all material and velocity data. The material and velocity data will be sent to buildInteractionData, which you can override.

Parameters
collisionThe original collision data.
contactPointThe contact point of the collision to use in calculations.

◆ processCollisionMultipleContacts()

void Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.processCollisionMultipleContacts ( TCollision  collision)
protected

Takes the given IImpactCollisionWrapper and processes all of it's contact points. Override buildAndSendCollisionParameters to receive the data and convert it to IInteractionData to send to an IImpactObject.

Parameters
collisionThe collision to process.

◆ processCollisionSingleAveragedContact()

void Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.processCollisionSingleAveragedContact ( TCollision  collision)
protected

Takes the given IImpactCollisionWrapper and processes it for a single averaged contact. Override buildAndSendCollisionParameters to receive the data and convert it to IInteractionData to send to an IImpactObject.

Parameters
collisionThe collision to process.

◆ processCollisionSingleContact()

void Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.processCollisionSingleContact ( TCollision  collision)
protected

Takes the given IImpactCollisionWrapper and processes it for a single contact only (the first contact). Override buildAndSendCollisionParameters to receive the data and convert it to IInteractionData to send to an IImpactObject.

Parameters
collisionThe collision to process.

Property Documentation

◆ ContactMode

ImpactTriggerContactMode Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.ContactMode
getset

How collision contacts should be handled.

Implements Impact.Triggers.IImpactTrigger.

◆ Enabled

bool Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.Enabled
getset

Should this trigger process any collisions? You should use this instead of the normal enabled property because collision messages are still sent to disabled components.

Implements Impact.Triggers.IImpactTrigger.

◆ HighPriority

bool Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.HighPriority
getset

Should this trigger ignore the Physics Interactions Limit set in the Impact Manager?

Implements Impact.Triggers.IImpactTrigger.

◆ MainTarget

ImpactObjectBase Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.MainTarget
getset

The ImpactObjectBase this trigger will use for interaction calculations.

Implements Impact.Triggers.IImpactTrigger.

◆ UseMaterialComposition

bool Impact.Triggers.ImpactTriggerBase< TCollision, TContact >.UseMaterialComposition
getset

Should this trigger use the material composition of the objects it hits? If true, interaction data will be sent for each material at the interaction point. If false, interaction data will only be sent for the primary material at the interaction point.

Implements Impact.Triggers.IImpactTrigger.