Impact Main Page API Reference Change Logs
Installation
Impact Tags Impact Tag Library Using Impact Tags
Impact Manager Material Mapping
Impact Materials Impact Material Interaction Sets
Impact Interactions Audio Interactions Particle Interactions Decal Interactions
Impact Objects Impact Object Single Material Impact Object Rigidbody Rigidbodies With Multiple Materials Impact Terrain
Impact Triggers Physics Triggers Impact Collision Trigger Impact Slide and Roll Trigger Impact Simple Collision Trigger Impact Speculative Collision Trigger Impact Particle Collision Trigger Other Triggers Impact Raycast Trigger
Extending Impact Custom Impact Triggers Interaction Data Custom Impact Interactions Impact Interactions Interaction Results IInteractionResult IContinuousInteractionResult Custom Impact Objects Custom Impact Materials Custom Impact Tag Libraries

Impact Triggers

Impact Triggers are components that tell Impact Objects when to play interactions and with what data. They are the origin that provides the parameters which are sent to the object’s Impact Material to be ultimately play the interactions defined on the material.


Physics Triggers

Included with Impact are a set of Impact Triggers that utilize Unity’s OnCollisionEnter and OnCollisionStay messages to trigger physics interactions. These triggers come in both 3D and 2D flavors.

Most Impact Triggers have the following properties:

  • Impact Object – The Impact Object collision data will be sent to. If empty, it will attempt to find an Impact Object on the collider that was hit or one of its parents.
  • Contacts Mode – How the trigger will handle collision contacts.
    • Single – Use only the first contact.
    • Single Average – Average all contact points together to create a single contact point. Both the Position and Normal of the contact points will be averaged.
  • Use Material Composition – If checked, the trigger will send collision data for each material present on the other object at the point of contact. This can be useful for objects like terrains where textures can be blended together. If not checked, it will use the most prominent material at the contact point.
  • High Priority – If checked, the trigger will ignore the Physics Interactions Limit set in the Impact Manager and will always process collision messages.

Impact Collision Trigger

The Impact Collision Trigger is used to play interactions for single collisions using the OnCollisionEnter message.


Impact Slide and Roll Trigger

The Impact Slide and Roll Trigger is used to play interactions when objects slide and roll against each other. This trigger uses the OnCollisionStay message.

The Slide and Roll Trigger has 2 extra properties:

  • Slide Mode – Whether or not to trigger sliding interactions.
  • Roll Mode – Whether or not to trigger rolling interactions.

Impact Simple Collision Trigger

The Impact Simple Collision Trigger is similar to the normal Impact Collision Trigger, but it does not receive any collision data (such as velocity or the object that was collided with). You should only use this in cases where you do not need detailed collision data and high performance is necessary.


Impact Speculative Collision Trigger

The Impact Speculative Collision Trigger is a special trigger that attempts to handle scenarios that the normal Impact Collision Trigger may not register due to its use of OnCollisionEnter. For example:

  • A large, long object that falls over, but stays in contact with the ground the entire time and so does not trigger an OnCollisionEnter message when it hits the ground.
  • Collisions against a single large non-convex mesh collider, where the floor and walls (and possibly ceiling) are part of the same mesh collider. If an object were to slide along the floor and hit a wall in this case, OnCollisionEnter would not be triggered.

This trigger has one extra property Max Collisions Per Frame, which is the maximum number of collisions that can be generated in a single frame.


Impact Particle Collision Trigger

The Impact Particle Collision Trigger is a special trigger for dealing with particle collisions.

When Particles is assigned to a particle system, the trigger will send interaction data when the particles of the particle system collide with the world to the Impact Object, as if each particle was its own Impact Object.

When not assigned a particle system, the trigger will act similarly to the Impact Collision Trigger, but will receive collision messages from particles.


Other Triggers

Impact Raycast Trigger

The Impact Raycast Trigger is a general purpose utility class for triggering interactions from raycasts. Some examples of its applications could be:

  • Footsteps – Raycasting downward from the player’s position to get the object they are walking over.
  • Weapons – Using raycasts for bullets (either hitscan or with simulated ballistics) to get the object a bullet impacted with.

The Impact Raycast Trigger is a static class, so you do not need to add it as a component. The Trigger methods take RaycastHit or RaycastHit2D data (so you need to perform the raycasting in your code).

The Impact Raycast Trigger has several methods that fall into one of two categories:

  • Trigger an interaction on the object that was hit by the raycast. You can either pass the Tag Mask, Velocity, From Object, and Interaction Type as separate parameters or pass in a pre-populated IInteractionData object. Use Material Composition, if enabled, will trigger an interaction for each material at the interaction point on the object that was hit.
    • Trigger(RaycastHit hit, ImpactTagMask tagMask, Vector3 velocity, GameObject fromObject, int interactionType, bool useMaterialComposition)
    • Trigger(RaycastHit hit, IInteractionData interactionData, bool useMaterialComposition)
    • Trigger2D(RaycastHit2D hit, ImpactTagMask tagMask, Vector3 velocity, GameObject fromObject, int interactionType, bool useMaterialComposition)
    • Trigger2D(RaycastHit2D hit, IInteractionData interactionData, bool useMaterialComposition)
  • Trigger an interaction on a provided object, gathering material data from the object that was hit. For these you pass in the IImpactObject you want to trigger the interaction on. Use Material Composition, if enabled, will trigger an interaction for each material at the interaction point on the object that was hit.
    • Trigger(RaycastHit hit, IImpactObject impactObject, Vector3 velocity, int interactionType, bool useMaterialComposition)
    • Trigger(RaycastHit hit, IImpactObject impactObject, IInteractionData interactionData, bool useMaterialComposition)
    • Trigger2D(RaycastHit2D hit, IImpactObject impactObject, Vector3 velocity, int interactionType, bool useMaterialComposition)
    • Trigger2D(RaycastHit2D hit, IImpactObject impactObject, IInteractionData interactionData, bool useMaterialComposition)