Trigger System

The trigger system is an upcoming feature to the Ballistic Unity Tools.

The trigger system is a set of scripts that are triggered by ships entering/leaving them, you can manually define the behavior of most trigger types although some triggers have built in behaviors by default. Built in behaviors do not stop custom behaviors.

## Cull Trigger

The cull trigger allows you to cull mesh renderers when triggered. There are three trigger types available.

**Inside Trigger** - objects will only be culled when the ship is inside the trigger.

**Hide On Enter** - objects will be culled when the ship enters the trigger. This is a toggle, see below for more information.

**Show On Enter** - objects will be unculled when the ship enters the trigger. This is a toggle, see below for more information.

### Cull Portals

Hide/Show On Enter are toggles which both start with different states. Hide On Enter assumes all objects referenced are visible and Show On Enter assumes that all objects references are hidden. For this reason you should setup the show/hide portals to toggle the same objects, for more information on this see below. Cull Portals store the sign of the triggering ships position local along the Z axis of the portal so the portal will only revert it's culling state if you cross over it in the opposite direction, for this reason make sure your cull portals face along the track.

Because of the sign being used, when you setup cull portals make sure you link the two portals with the LinkedTrigger option, this will allow you to reset the state of other portals once the portal has been triggered. Cull portals will disable if a link isn't defined.

### Cull Pools

A cull pool is a cull trigger that is referenced to by another cull trigger. A cull trigger automatically becomes a cull pool if it is referenced too by another trigger.

Cull pools allow you to share objects between cull triggers, used for setting up portals that toggle the same objects. Cull pools are not active triggers and will not do anything if you set them up to be triggered.

## Transform Interpolator

The transform interpolator allows you to interpolate an object between two defined transforms when triggered. A is where the the object will be when idle and B is where the object will move too once triggered. You can set how long it will take the object to reach B using the InterpolationTime setting. Target is the object to affect.

## Animation Trigger

The animation trigger allows you to play an animation clip when triggered. This relies on using the legacy Animation system in Unity, make sure you set your import settings to legacy for the object you want to be animated.

If Override Play State is enabled then the animation will always be played from the start again regardless of it is currently playing or not, if Player Only is enabled then only player ships can trigger the animation to play.

## Audio Trigger

The audio trigger allows you to trigger an audio source to play when a ship enters the trigger.

If Override Play State is enabled then the sound will always be played regardless of it is already being played, if Player Only is enabled then only player ships can trigger the sound to play.

If the repeat delay setting is set above 0 then the audio cannot be played again until the time has ran out.