We will now write a simple script that is directly applicable in our example project and extend it afterwards to be more generic and reusable, using parameters.
Doors and elevators are typical interactive elements in buildings. Most buildings have no other moving parts. To rotate a door manually or to use scripting is not that different. However, there are a few tricks to get it correct. These are as follows:
DoorLeaf. Set its position to X=
0and scale to X=
0.1. This ensures that the lower side corner of the door leaf is sitting in the center or our scene.