Using Animation Events to throw an object

Now that your animated character is ready, you might want to coordinate some of her actions with her animation states. In this recipe, we will exemplify this by making the character throw an object whenever the appropriate animation clip reaches the right time. To do so, we will make use of Animation Events, which basically trigger a function from the animation clip's timeline. This feature, recently introduced to the Mecanim system, should feel familiar to those experienced with the Add Event feature of the classic Animation panel.

Using Animation Events to throw an object

Getting ready

For this recipe, we have prepared a Unity Package named Throwing ...

Get Unity 5.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.