The vizact library comes with many synchronization actions. Synchronization actions allow you to freeze an objects action controller until a certain event occurs. These events could be key presses, expired time, or a signal event. Here is a simple example of fading an object out after the 'f' key is pressed:
Another common synchronization action is to wait for a specified amount of time.
This sample code will fade an object in, wait 2 seconds, and fade it out:
However, let's say you wanted to synchronize actions of multiple objects. For instance, let's assume you already have the objects key and door, with actions turnkey and openDoor. What we want is to perform the openDoor action after the turnkey action is finished. Since these actions are performed on different objects we can't simply add one after the other. What we need in this case is a signal object. A signal object contains two actions. One that triggers the signal and one that waits for the signal. So, for this example we would trigger a signal after the turnkey action and wait for the signal before the openDoor action. Here is what the code would look like: