How do you make a Door open Gradually on leaver pull?

Hay guys, im trying to create a complex door which opens via pressing multiple leavers of sort, this will then open the door gradually each time (i.e you would pull one leave and it would open a door 1/5 of the way whereas when you press the others it would do the same making it go from 1/5… 2/5…3/5…4/5… and then fully open). Has anybody got any tips on how I would create a blueprint for this?

I’m a noob so maybe there’s a better way, but I’d have a float variable that controls the door’s movement (make it into a rotation if it’s a swinging door) have the levers add/subtract to that variable and interp to the new value.

Use a timeline and pause it at the necessary intervals (1/5, 2/5, etc).

That example does not show it, but you want to use Lerp to go between the beginning door position and the end door position, which is basically a ratio of 0-1 for the Lerp Alpha. So you would pause the timeline in your case at .2, .4, .6, .8 and 1(open).

Hay guys. thanks for the help, iv been playing around trying to get this to work for a while now, whilst i understand briefly what you guys are saying im finding it really hard to put into practice as blueprints is something I struggle with. I’ve manager to make it so a lerp makes the door open 0.5 of the way but it wont reset and redo it when i press ‘E’ over and over. Iv played around with the float aspect of it also but got this to work with just a vector track. Iv included an image of what worked for me to some degree and cut out all the jibble jabble which made the door fly away and all sorts. How would I make it so It would go in a sequence and reset the timeline and vector values (of sort) for each other button I press (not including the same one) :S10eacff70072b57ad4e6d28a6924c2fd41fbd770.png

Here’s what i’d do.

The lever blueprint.

From BeginPlay - add a getAllActorsOfClass (Your door blueprint) - promote this returned array to a variable called - MyDoors or something.

From your CastSucceeded node (in place of your door move node) - Add a FLIP/FLOP node - Make a timeline with a float curve that goes from 0 to 1 over 1 second. You could call this float curve - LeverAmount. Attach one of the flip/flop outs to play and the other to reverse. Drag off the LeverAmount output of the timeline and use promote to variable to LeverAmountFloat - attach the update from the timeline to this setter.

The Door blueprint.

From BeginPlay - add a getAllActorsOfClass (Your Lever blueprint) - promote this returned array to a variable called - MyLevers or something.

Make a custom event called UpdateDoorPosition. Make a float variable called LeverAdder. From your UpdateDoorPosition event set this LeverAdder to 0. Drag in a getter for your MyLevers array. Drag off this and make a ForEach loop. Attach the LeverAdder setter to the in of this. In the loop node drag off the MyLever ref and start typing LeverAmountFloat to get the lever amount from each lever blueprint. For each loop add this amount to LeverAdder.

This means when you have - for example - 6 levers all pulled you’d get a total of 6.0 in the lever adder variable. So you should divide this value by the length of MyLevers - this means you can have as many levers as you like and if they’re all pulled you’ll have a total of 1. Use this figure to drive a transform lerp of your door’s position. To do this properly DON’T use MoveComponentTo - use SetLocalTransform.

Then go back to the lever blueprint and add the UpdateDoorPosition after the LeverAmountFloat setter. You can do this by dragging in your MyDoors var and dragging off it and typing UpdateDoorPosition. This means (without a test at least) if you have more than one door object they will all open.


Add an editable variable called DoorID to the levers and doors - this way you can have lots of doors controlled by lots of different levers. - Just do a test on the forEach loop in the door blueprint.

EDIT - Just looking at your blueprints again - when you make your timeline drive a lerp, you need to have your timeline produce a float, not a vector. This float should be between 0 and 1. You plug this float into the alpha of your lerp. Imagine a lerp as a cross-fader on a mixing desk. It slides between whatever’s in A and B. If you have a Lerp(Float) and you put 0 into A and 100 into B, then your alpha value of 0 to 1 will slide this value between 0 and 100. If you have 500 in A and 10 in B, then the output will slide between 500 and 10 based on the 0-1 float in the alpha. If you use a Lerp(Transform) then you can make a whole position/rotation/scale movement which slides between one position and another based on the 0-1 alpha.

In our case we’re not driving the lerp directly from the timeline - we’re adding up all of the lever’s amounts, dividing it by the amount of levers (Which will get us a value between 0 and 1) and driving the transform lerp based on that.

Your transform lerp should have the position of the door closed in A and the position of the door open in B

Hay Dannington, I have tried your method and am having problems, the more levers I add it just shoots away further and further, sometimes even going the opposite direction when I press the first button, I used ‘AddLocalTransform’ as there was no ‘SetLocalTransform’ in the options, Im unsure whether that is the problem but I feel like it is the values going wrong somewhere :s1.png

Ok - this is almost right. Only changes are in the door blueprint I think.

  1. The first node after the event - UpdateDoorPosition needs to set LeverAdder to 0. LeverAdder is a variable which adds up all of the LeverAmounts from all of the lever objects you have in the scene - it needs to start at 0.

  2. In the loop you need to Get LeverAdder, add it to LeverAmount and set LeverAdder to that. This will add up each lever’s amount.

  3. You don’t use a timeline in the door blueprint - the ones in the Lever blueprint(s) will handle the animation for you. From the ‘completed’ output of the ForEach loop do a SetLocalTransform (not add) and connect your Lerper to it as you have done (And your door static mesh component).

  4. Drag off your ‘MyLevers’ array and type LEN - this will return the amount of levers you have in your scene - If you have 6 levers the length of MyLevers should be 6.

  5. You need to do LeverAdder divided by this LEN node and feed this into the alpha of the transform lerp.

So if you have 6 levers all activated then when you count each LeverAmount it will come to 6. So 6 divided bt 6 is 1 - which is your door fully open. If any of the levers aren’t activates you’ll get a value less than one.

Also - I don’t really do things the way you have in regards to enabling/disabling input in the Lever blueprint, but i’d say you want to connect the DisableInput node to the CLOSE pin on the gate.


Here’s a pic


This worked perfectly, exactly what I wanted! I even managed to go add a little bit more complexity after messing around with it for a little while. I appreciate the help with this, you have not only helped me sort it out, but taught me a great amount of something I wouldnt consider a strong point of mine through explaining what everything does - sorry for the late reply, been very busy with projects

Glad to help out - I like posts like this, you read the top one and start thinking about how you’d do it. There are probably loads of ways of doing this.

Something you could try - if it’s a creaky old door - is to add some juddering to the movement by changing your timeline graph. As long as it stays between the range of 0 to 1 you can make it start slow and and with a snap or judder backwards and forwards by adding keyframes - as long as it starts at 0 and ends at 1 you could have some fun with the movement.