In this recipe, we will animate a trigger position and use it to create a death trap. You can use Unity's Animation View to create various game play mechanisms with minimum scripting.
Before we start, you should prepare a death trap model. We are using a "press trap" as an example. It contains two identical moving elements. See the following screenshot:
The model is not skinned and has no rig; instead, the moving elements are separate objects. We will animate them with Unity's Animation
View. You can also use the example Unity project provided and go to the Chapter 02 Working with the animation view\Recipe 06 Animating triggers - creating a death trap
directory. You will find an Example.unity
scene there. If you play the game, you can see the trap working. If you open the scene, you will find the Trap
game object with the LeftTrap
and RightTrap
game objects as its children. Those child objects are the only ones animated in this example...