Impact Main Page API Reference
Installation
Impact Tags Impact Tag Library Using Impact Tags
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 Rigidbodies With Multiple Materials 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 2 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.
  • 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.

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) from the collision message. 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.


Rigidbodies With Multiple Materials

Impact Triggers work a bit differently than you may expect on Rigidbodies with multiple materials, due to how Unity sends collision messages for Rigidbodies. Only the root of the Rigidbody (i.e. the object with the Rigidbody component attached) recieves collision messages, so your trigger components must be added on the same object as the Rigidbody. For Rigidbodies with multiple materials, you can leave the Impact Object field empty and the trigger will attempt to find an Impact Object on the collider that was hit or one of its parents.


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 data (so you need to perform the raycast in your code) and an IInteractionData object. There are 2 methods you can use.

Trigger(RaycastHit hit, IInteractionData interactionData)

• Triggers an interaction on the object that was hit. The interaction data you send should already have the Velocity, TagMask, ThisObject, and Keywords already defined.

Trigger(RaycastHit hit, IInteractionData interactionData, IImpactObject impactObject)

• Triggers an interaction on the given impact object. The interaction data you send should already have the Velocity, ThisObject, and Keywords already defined.