Links

Triggers

This article describes the work of triggers in the Animation Mode.
In MANU, any animation is preceded by a trigger. We need triggers to launch animations in our game. They control the start and the end of the animation. In simple words, a trigger is a certain event during the game that is tied to the animation playback. It is an object that causes an animation to occur.

How to add a trigger?

First, you should add the animation. Go to the Library and press the Animation Icon. For animation editing, switch to Animation Mode.
Second, you will see Icons on the left upper corner of the Animation panel: Timeline and Triggers. Hit the Triggers Icon and you will see the Trigger Panel. To add triggers, click on the icon Add New Trigger and choose what you need from a dropdown list.
A quick reminder: only kinematic objects can be animated, so don’t forget to set up an appropriate type of Physics before you start working with triggers.

Trigger Types

There are 5 types of triggers: On Launch Scene, Key, Collision, Animation, and State Machine. Each trigger has his own settings.

On Launch Scene

On Launch Scene is an independent trigger that activates as soon as the game starts. You can manage the trigger hovering over the Icon and using a dropdown list that appears after right clicking. Go to Managing Triggers to know more (link).

Key

Key combines a group of triggers that use keyboard keys to trigger animations. There are 3 of them: Key Down, Key Pressed, and Key Up. All key triggers have their own color Icons.
By clicking on the Icon of the existing trigger you can change the type of key triggers using a dropdown list.

Key Down

Key Down trigger will start when the key is pressed.

Key Pressed

Key Pressed trigger will be activated while the key is held down.

Key Up

Key Up trigger will start when we let go of the key.
Note: you can use any keys from your keyboard to launch the animation, except Fn.

Collision

Collision consists of a group of triggers that are activated when the interaction between the objects occurs. From a dropdown list you can choose from 4 options: No Collision, Collision Started, Collision Continue, Collision Ended. All collision triggers have their own color Icons.
You can change the type of collision triggers by clicking on the Icon and choosing the ones you need from a dropdown list. It is also possible to choose and change objects of collision by clicking on the popup menu
Note: not all objects created in the game appear in the dropdown list for collision triggers. Only objects with Physics can collide.

No Collision

No Collision is a trigger that keeps the animation playback when the objects are not in the process of interaction.

Collision Started

Collision Started is a trigger that is initiated when objects have just collided. This trigger captures the moment of collision itself.

Collision Continue

Collision Continue helps to keep the animation playback while the objects are in the process of interaction.

Collision Ended

Collision Ended is a trigger which captures the moment when the collision between the objects is over and launches the animation after that.

Animation

Animation is a group of triggers that are initiated when the playback state of another animation changes. There are 3 possible options: Animation Start, Animation Stop, Animation Continue. Each animation trigger has its own color Icon.
For the animation trigger, you can choose the animation, which was already created from the pop-up menu, to launch the animation you need.
By clicking on the Icon of the animation trigger you can change the animation trigger type.

Animation Start

Animation Start is a trigger that launches the animation of one object after capturing the animation start of another object.

Animation Stop

Animation Stop helps to start animation of the object after the animation of another object ends.

Animation Continue

Animation Continue launches the animation of the object while the other object is still being animated.

State Machine

These types of triggers involve the Main Character to create animations in the Scene.The Main Character has the State Machine State. To know more, go to (link). State Machine triggers allow you to manage the animation playback, depending on the current state of the State Machine. The State Machine State has 3 options: State Start, State Stop, and State Continue. Each State Machine trigger has its own color Icon. By clicking on the Icon you can change the trigger type.
To add the state of Main Character Body choose the one you need from a dropdown list.

State Stop

State Machine State Stop: the animation will start when the state of the Main Character stops.

State Start

State Machine State Start: the animation will be activated when the state of the Main Character begins.

State Continue

State Machine State Continue: the animation will last throughout the duration of a certain character state.

Trigger Logic

Triggers can have two states: TRUE and FALSE. If the condition specified by the trigger is met, the trigger state will be TRUE. When this condition is not met, then the trigger state will be FALSE. All transitions of triggers from one state to another (from TRUE to FALSE and from FALSE to TRUE) activate the trigger logic. If, for example, the trigger is set to collide one object with another, then as long as there is no such collision, the trigger has the FALSE state. When a collision occurs, the trigger changes its state to TRUE. When the trigger state is TRUE, it sends the command “animation play”. When the trigger state is FALSE, it gives the command “animation stop”. Animation continues to play, even when the play event is sent again (state true). Animation ignores these commands until it finishes its playback. While the animation is playing, it does not accept new play commands. When the animation play period stops, the object listens to the trigger command again. Animation will stop if the stop command is sent (state false). It stops at the moment when this command appears, even before finishing its playback.

One-time trigger

A one-time trigger exists for an instant. For example, Collision Started is a one-time trigger, it registers the moment of objects’ collision when it has just happened. Other examples of one-time triggers: Collision Ended, Key Down, Key Up, State Machine State Start, State Machine State Stop, Animation Started, Animation Ended.

Long-running trigger

For example, Collision Continue is a long-running trigger, its state is long in time and exists as long as the interaction of objects continues. Other examples of long-running triggers: Animation Continue, Key Pressed, Collision Continue, State Machine State Continue.
Note: It is very important to distinguish a one-time trigger from a long-running trigger, especially if you group or combine them to launch the animation. To know more, go to the Scene (link).

Trigger chain

In MANU, you can use as many triggers as you want to launch animations, thus creating a chain of triggers. The concept of a trigger logic chain allows you to:
  • combine several triggers with the help of common logical operators (AND, OR, NOT) such that the output result of the trigger logic chain will depend on which triggers are used, as well as on the meaning of the operator.
  • set the calculation sequence in the trigger chain by grouping triggers
  • give a more complex condition for triggering the animation.
All these options, offered by MANU, open up more opportunities for the user compared to the usage of only one trigger to start and stop the animation. Creating trigger chains, remember that the calculations in the chain occur sequentially, from left to right. The calculation algorithm checks each trigger and operator in order. If one of the triggers changes its state, even for a fraction of a second, the mechanism for checking the trigger chain will start again. The chain checking does not always occur, but it is triggered every time an event occurs. The new event causes the trigger state to change from TRUE to FALSE. The combination of trigger states (TRUE and FALSE) defines the logic of the trigger chain. If, after all calculations, the trigger chain output is TRUE, then the animation starts. If the output is FALSE, then the animation does not play. When, during the animation playback, a new event occurs, it activates the checking of the trigger logic chain. The animation playing will stop if the output of the checking is FALSE. If the output of checking is TRUE, then the running animation continues to play. The animation does not start again, it just keeps playing, ignoring the TRUE value.

Grouping triggers

The trigger chain allows you to create complex conditions for the activating animation. Triggers in the chain are calculated sequentially. If you want to set the order in calculation of triggers you should use the grouping of triggers. You can combine multiple triggers into groups and create multiple groups. Using the trigger groups helps to control the order of calculation.

Logical operators

OR

OR returns TRUE value if any of the arguments/elements are TRUE, in the opposite situation, it will return FALSE. You need this logic operator if you want to initiate the animation by two or more triggers in condition that only one or more triggers are activated. By default, when you add a trigger, it joins the existing ones by OR.

AND

AND returns a TRUE value if both elements are TRUE and returns FALSE otherwise. If you want that more than one trigger launches an animation, provided that both/all triggers have to be activated, then you need AND as a logical operator to create a chain of triggers. By default, when you add a trigger, it joins the existing ones by OR. You can change it simply by clicking on the AND Icon.

NOT

NOT performs a logic negation by inverting TRUE to FALSE and FALSE to TRUE. By hovering over the added trigger, you will notice that it is highlighted a little bit. After that click on the right mouse button and choose from the dropdown list Add NOT. If you have changed your mind, just click Remove NOT on that list. NOT can be set not only for one trigger, but also for the trigger group.

Truth table

Trigger 1
Operation
Trigger 2
Result
YES
OR
YES
YES
YES
OR
NO
YES
NO
OR
YES
YES
NO
OR
NO
NO
YES
AND
YES
YES
YES
AND
NO
NO
NO
AND
YES
NO
NO
AND
NO
NO

Managing triggers

You can manage triggers using a dropdown list which appears when you hover over the selected trigger and click on the right mouse button.

Turn Off/On

The Turn Off/On option is used to check the logic of trigger chains. This option is necessary for testing and finding errors in the trigger logic. For example, when a chain of 6 triggers does not work, you can turn them on and off in sequence, and then perform a check. The turned off triggers are ignored during the chain checking process. Note that along with the turned off triggers, the logical operators in front of them are also turned off and ignored.

Group

To create a group of triggers, move the mouse cursor over the desired trigger and select Group from the drop-down list. A green border will appear around the selected trigger, which changes its color to white if you hover the mouse cursor over it. Next, add the necessary triggers to the group using the Create After/Before or Paste After/Before options for cut or copied triggers. You also can use Duplicate if you need the same trigger in your chain.

Ungroup

Hover the mouse cursor over the green border around the trigger group, and it will immediately change color to white. Then, click the right mouse button and select Ungroup from the dropdown list.

Create Before/Create After

Create Before and Create After allow you to create a trigger at a specific location in the trigger chain. Just hover over the trigger after or before which the new trigger should go, and then click on the right mouse button to invoke the dropdown list. Both options have dropdown lists where you can choose all types of triggers that MANU offer.

Cut

The Cut option temporarily removes the currently selected trigger from the trigger chain. After you cut the trigger, you can place it to a different location in the current trigger chain, or to a different animation. Simply click Paste Before/Paste After options from the dropdown list or click on the area between triggers and you will see the Paste option, which allows you to put the trigger at the end of the trigger chain.

Copy

When you press Copy, the selected trigger remains in its original location. To put the trigger on the desired place use Paste Before/Paste After options from the dropdown list. By pasting the copied trigger, you actually duplicate it.

Duplicate

With the Duplicate option you copy and paste the selected trigger in one click. The new trigger will follow the selected one.

Paste Before/Paste After

The Paste Before/Paste After options allow you to place the cut or copied triggers anywhere in the trigger chain. You can paste triggers multiple times or in several places without copying it again.

Delete

With Delete you can remove all undesired triggers from your logic trigger chain.