Animation paths support adding multiple event triggers along the path. These event triggers can be used to determine when the path reaches a certain point. A full sample script can be found at \examples\animationPaths\animationPathEvents.py.
Event triggers can be placed at any time, distance, control point, or at the end of the path. You must specify a name when creating an event trigger. The name will be provided when the event is triggered, allowing you to distinguish between multiple event triggers. The following animation path commands can be used to add event triggers:
Method | Description |
<animationpath>.addEventAtEnd(name) | Add an event to the path which will be triggered when the path reaches the end of one full loop. |
<animationpath>.addEventAtTime(name, time) | Add an event to the path which will be triggered when the path reaches the specified time (in seconds) from the start. |
<animationpath>.addEventAtControlPoint(name, index) | Add an event to the path which will be triggered when the path reaches the specified control point index. |
<animationpath>.addEventAtDistance(name, distance) | Add an event to the path which will be triggered when the path reaches the specified distance from the start. |
The following example code demonstrates how to add event triggers:
Event triggers can be removed by name using the <animationpath>.removeEvent command, or all event triggers can be removed using the <animationpath>.clearEvents command.
When the animation path reaches the location of an event trigger during an update, it will trigger a viz.PATH_EVENT. The event will provide a single event structure containing the following attributes:
Name | Description |
e.object | The animation path object generating the event |
e.name | The user specified name of the event trigger |
e.time |
The time within the path the event was scheduled to trigger |
The following sample demonstrates how to handle a viz.PATH_EVENT:
The <vizact>.onPathEvent command can also be used to handle events from a specified path and name:
The <viztask>.waitPathEvent command can be used within a task to wait for an event from a specified path and name: