Let the animation drive

There will often be times where there is a lot of contextual information in the animation data that has been given to us by our animators. In our case we have an animation where our character will go through a throwing animation to represent throwing a grenade, but currently we have no way of actually putting a game object into the world that will respond to this. One certainly wouldn't want to hard code the frame of animation that the throw represents, as this is likely to change throughout the course of the game. We can, fortunately, associate any arbitrary part of an animation with a callback in Unity.

Animation Events

In Unity's animation system we have the ability to associate events with arbitrary parts of an animation. Unity refers to this capability as Animation Events. With an Animation Event we can have the animation system execute scripts and consequently drive some of the logic of the game. Animation Events can be added to any Animation Clip that you have imported from your modeling environment or any ad hoc animation you create using the Animation view.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.84.171