To animate the trigger position and create a death trap, follow these steps:
- Create an empty object in the scene and name it Trap. It will be a parent object for our moving parts.
- Put your models into the scene and parent them to the Trap game object. The models should have descriptive names, for instance, LeftTrap and RightTrap.
- Add an Animator component to your Trap game object (the root object of our death trap). Set the Update Mode to Animate Physics.
- Go to Window | Animation and open the Animation View.
- Create a new Animation Clip by clicking on the Create button.
- Select the LeftTrap game object and make sure the record button is pressed (in the upper-left corner of the Animation View).
- Move the LeftTrap game object ...