Network state automatic door
Last updated
Last updated
The example provided in Network state position toggle shows how to synchronize an object's movement between two positions in 3D space. The example on this page shows how you can expand on that example to create an automatic door.
The two Transforms define the open and closed states for the door. They could be two different positions in 3D space for a sliding door, or two different rotations for a swinging door.
There is an additional component to activate and deactivate a game object depending on the user's proximity. We also use the same toggle component as the Network state animation start/stop example to call methods in response to the activation and deactivation of the game object. These methods set the state of the generic movable component.
The following diagram shows an example of how to arrange the components in Unity, and the required references.