How to do it...

To create automatic doors, follow these steps:

  1. Select your Door Frame game object, and add an Animator component to it. To do so, click on the Add Component button in the Inspector and choose Animator. Make sure to add the component to the Door Frame instead of the Door (the parent instead of the child). Set the Update Mode of the Animator component to Animate Physics.
  2. With the Door Frame game object selected, go to Window | Animation to open the Animation View.
  3. Create a new Animation Clip and call it Closed; this will be our animation for the closed door. To create a new clip, click on the drop-down list below the playback buttons and choose the Create New Clip option.
  4. Click on the Add Property button and find your Door ...

Get Unity 5.x Animation 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.