Similar as item creator, a trigger creator window is a tool that
helps automate the creation of triggers.
It creates 'GenericTrigger' component on an assigned object.
There are triggers which start an animation, like climbing onto something and ones that don't start an animation, like pick up a weapon.
Those triggers that start animation I'll call actions.
Actions are harder to create because of synchronization of the trigger system, animation clip and match target.
Animation clip used in action needs a proper setup which I'll explain in the following text.
To open trigger creator click on 'Tools/Combat Framework/Trigger Creator'.
- assign object with collider component to 'Trigger Object' field.
- next drag all objects with animator component to 'Animator Objects' field. If an animator is shared, only use one instance.
New animator state will be created in that animator which will start to play upon triggering action.
- enter the state at which animator will transition to after action is ended. If more is needed, created directly in animator after a trigger is created.
- drag target transform to 'Target' field. Target is used as match target position effector and character orientation direction.
- if 'switch target direction' is set then the system will use backwards direction as orientation.
- if 'replace' is ticked, a state with the same name will be replaced – otherwise, it will throw an error.
- you can choose a place where to disable physics.
Disabling physics is useful so that character action animation
does not get hindered with physics.
- you can assign custom events at various trigger times.
- choose input at which trigger will fire. If 'Nothing' is chosen trigger will not fire. The trigger will fire always if 'Everything' is chosen.
- there are options to use lerp upon trigger starting to adjust character at a position where it needs to be positioned.
You can set that only position or rotation 'lerping/slerping' will be used along with individual times.
- Enable 'Add Match Target' checkbox to use match target with action.
New options appear where you can tweak match target values.
Let's repeat that animation clip needs to have a proper set up for use with a match target.
To set up a match target system on animation clip, some requirements need to be met.
- add 'pMatchStart' and 'pMatchEnd' curves to animation clip.
- in 'pMatchStart' enter the time at which match target starts at 0.0 keyframe.
- in 'pMatchEnd' enter end time of match target at 0.0 keyframe.
Next, some events are needed:
- place 'TriggerEndEvent' at the end of the action animation clip.
- place 'OnMatchTargetStartEvent' at the time of 'match target' start.
- 'OnMatchTargetEnd' event is optional. You can place it if
something needs to be executed when 'match target' ends.
- in 'OnMatchTargetStartEvent' add time of match target start and end in format of: 'matchStart;matchEnd' ( for instance: '0.1;0.7' – begin at 0.1 and end at 0.7 ).
- click on 'Create' and it's done.
Note that all values can be tweaked after a trigger is created.
Also 'GenericTrigger' component holds even more options to
tweak.