Unity Project 5: Opening Doors


Scene view

Animator panel, where you can create a motion path for the door to open and close.


Animator panel
Connected nodes which tell you whether the door is open or closed based on a boolean decision.


Door is open

Door is closed

Gameobject with an animator component, that allows the door panel to be animated and has the 'DoorOpenForPlayer' script which opens the door when the player is in close proximity to the door.


Door frame inspector

When the player is in close proximity to the door, the door opens.


Door opened

Door closed, as the player is too far away from the door for it to be open.

Door closed


Hierarchy

Parameter 'IsOpen' (Boolean) is unchecked so that the door begins closed as it isn't open otherwise the door would be open.


Parameters
The 'Loop Time' box needs to be unchecked on the animated asset otherwise the door will continuously open and close. This looping isn't needed as the door open/close animation is triggered by the player's collision with the door frame. 


Open animation inspector

Comments

Popular posts from this blog

Logo Design

Bootstrap Template