This Door plays tricks on you. As you move towards it, it closes. As you move away from it, it opens.
We achieve this using Get Distance, some Math, and Set Animation Time.
FSM Diagram
States
Events
- closeDoor - sent to close the door.
- openDoor - sent to open the door.
Variables
- player - a reference to the player game object.
- distance - the distance of the player to the door.
- closeAmount - a normalized (0-1) amount to close the door, based on player distance.
Actions Used