Stefan Boeykens with this simple example of a door that will open automatically when the user approaches in Unity3D. The first video explains the main object setup: a cube as a door leaf, made child of an empty GameObject as the rotation center. And a non-visible box which will become our trigger.
This is a simple example of a door that will open automatically when the user approaches.
This is the second part of the opening door video. Here we will attach a quite simple script to the door to let it open smoothly. The script uses an easing technique to go fluently from closed to open. When entering the trigger, the OnTriggerEnter event will open the door. When leaving the trigger, the OnTriggerExit event will do the reverse smooth animation.