Animation Events
Animation events are markers that are placed in animation clip assets to indicate that something of interest happens at a certain time during playback.
These events can be used for mundane things like foot down markers, in a walking animation, to vital gameplay information like shot fired in an attack animation.
Whenver the EZ animation system plays back any animation clip, it also inspects the event track. For every event that it encounters, it broadcasts an ezMsgGenericEvent
with Message
set to the value of the event's name.
If you have a TypeScript or Visual Script (or custom C++ components that is also an event handler) attached to any parent node of the animated mesh, you can handle this type of event and react with the desired game logic.
In the video above, the clip contains a marker for when a shot is fired. A script reacts to this by spawning a projectile. In this example one could also just spawn the projectile at the same time at which the shoot animation is triggered, however, if the animation was longer, the exact time at which to do this, would be more difficult to estimate and using an event makes it much easier.
The clip above shows the event track at the bottom of an animation clip asset. This is how you add event markers to a clip.