Download

How to make a door open quickly but close slowly?

Hello! I am very very very new to UE4 and I need some help with BP. So I have this blueprint which I attached. It opens a door smoothly in 10.5 seconds when our pawn stands in a trigger volume and also closes it. What I want to do is make the player to race against time. I have all the obstacles that appear after triggering the volume coded in C++ (just some simple walls) but I don’t want the player to stand in the trigger volume for 10.5 seconds waiting for the door to open. I only want the door to close in 10.5 seconds. The process should be repeatable meaning that if the player has failed he can trigger the volume again. What I’ve already tried is making a second timeline and making another rotator which didn’t help. I am using Unreal Editor version 4.16.2 (still too scare to update to 4.17). I would really appreciate if someone could guide me through this. Thanks in advance! :slight_smile:

Try doing this. First make 2 rotators, Closed and Open Rotation. Closed Rotation = World Rotation, Open Rotation = World Rotation + 90.0 on the Z Axis.

‘Add a Timeline…’, add a Float track to it, make the Length = 1.00 and add 2 keys, positioned at 0,0 and 1,1. Then you can Lerp (Rotator) between Open and Close Rotation and set the door’s rotation to this lerp.
**TIP: **Because the timeline is a component, you **don’t **need to connect the left execution pins to anything, you can directly call Play From Start in the custom event instead by getting a reference to the timeline.

Finally, create 2 custom events for Open and Close which Set the Play Rate of the Timeline to “1.0 / X”. Because we make the Timeline length 1.00 seconds, if we divide 1.0 by X, X can be replaced for however long you want the timeline to play for. So on Open Door, I set it to (1.0 / 2.0) which means it will play the timeline over 2 seconds. And on Close Door, I set it to (1.0 / 10.5) which means it will take 10.5 seconds to reverse the timeline.

On Event Open, make the timeline “Play From Start” and On Event Close, make the timeline “Reverse From End”.