Thursday, 29 November 2018

Unreal: Opening a door



Using the door provided in the Starter Pack, I have created a blueprint using the door frame by the selected option in the image above.


In the viewport of the blueprint I have added the door inside the frame, and a box simply acting as a box collider would in Unity. 



In the template tab, it is essentially the same as any other animation timeline. Simply by adding a keyframe on 0, we set the rotating of the door to 0. Then at one second (time taken for the door to complete the animation), we set the rotation to 90 degrees (fully open).



Simply by implementing On Component Begin Overlap, which is essentially the same as using OnTriggerEnter() in Unity and End Overlap being the equivalent of OnTriggerExit() we can enable and disable the Player Controller input when our player is inside the invisible box we created on the door, which is practically the same as a Box Collider in Unity.

With the E key, because this is the most commonly used key in games for interacting, we use the OpenDoor and update the rotation of our door using the Make Rotator node to alter it. It is simple to implement a feature to reverse the opening of the door, but I have intentionally made it open only one way because I hope to implement a feature to open doors for a required amount of points, and once it has been opened it cannot be shut again. It will also open new entrances for zombies to enter, and prevent the player from shutting themselves in one room for the entire game.

No comments:

Post a Comment

Unreal: Project Evaluation

Unreal is visually enticing and appears to be extremely user-friendly. In the beginning stages, I found it really nice to use and I was exc...