How to make multiple movable doors in the level blueprint?

Hello all,

I have been trying to a project using UE4 where there are different kinds of movable doors. For the first one all went well, I created a trigger box and set the events based on the collision with that trigger box and used a timeline to apply the movement to the door. One thing i had to do was to get the door location at first so i could add the movement that particular location, otherwise the door would teleport to the origin and move in that location. For this i used the Eventbegin to define the door location as soon as i hit play. So far so good. But problem came when i tried to do the second movable door, it’s just like the first one, the only difference is that it’s mirroed and goes in the inverse direction. I used the same scripting with some ajustments but i failed to make it work right because it simply wont stick to it’s original position and would rather go straight to the origin. After a lot of nerve wrecking debuggin I found that the problem was at the very beggining when the EventBeging get the doors locations. It looks like i can only attach it to one door location and get the location of that door rather and get the location of the two doors and it’s impossible to do a copy of the EventBegin icon. I hope i made myself clear, I’m new to UE and I would like to understand what am i doing wrong. Thanks in advance.

You can always set multiple variables at the beginning for each door’s location or rotation. Then, you’ll want to use Timelines to move them.

Right click to create a Timeline. Double click the node to go into its editor. For this scenario, I used 1 second Length for the Timeline (set at the top) and used float track (f+ button at the top) to make a 0 to 1 value over the course of 1 second (right click to create a key, where you can set its time and vaue).

The reason for that is I am using a Lerp, or Linear Interpolate (that means go from A to B according to Alpha, which is 0=A all the way to 1=B), to handle the change in rotation or location (I made pics for both depending on if these are rotating or sliding doors).

So we use the location or rotation variable you set at the beginning (this solves your problem of it snapping to the origin; we are simply starting with where it’s already at) from the referenced door to supply the A values of the Lerp. For the B value, I again used its location but used a Break to split it up, so I could add 90 to the Yaw rotator. The Alpha uses the float track from the Timeline, so it goes from A to B in 1 second, swinging 90 degrees smoothly.

Finally, use a Set Actor Rotation for your door reference and plug in the resulting output of the Lerp.

You can also see that I set up an End Overlap event that plugs into the Reverse track on the Timeline. That’s just an example of course, and will make the door reverse its rotation back to the original. Timelines are very nifty like that. You have tons of control over your values. Play around with them and you’ll surely find other uses.

Here’s the BP setup, both for rotation and location:

EDIT: I used the wrong nodes here. Instead of using Get Actor Rotation/Location, you’ll want to use the variables you established earlier containing their initial rotation or location.

Let me know if you need any more info!

Thank you for your response Gage. I still can’t make to work. I used your scripting and even tryed to make some adjustments but none of that has worked since even it doesnt go back to the origin as before, it just goes along the axis much further than it should and then it doesn’t trigger the reverse reaction. The only scripting that works is the one where I attach the initial location of the door to the event begin node. I’ll show the ss of the piece of scripting that i’m talking about.

But as I told before, I can’t duplicate this scripting for the other door since i can’t make the event begin play to get the location of another actor. Can’t understand why.

Since I didn’t have actual details for what you wanted, my example was meant to inform you of the Timeline approach. It’s up to you how you use it

I can certainly give you concrete info if you give details on what exactly you are wanting to happen with these doors

Oh shoot! I totally did something wrong in my script. Sorry about that! Using Get Actor Location in the Timeline like I said would give an exponential change, which is not good.

Your method of establishing the location variable is correct. My apologies.

So what you can do now is have a location variable for each door. Door 1 Initial Location, set from Get Actor Location of your first door, followed by a Door 2 Initial Location, set from a Get Actor Location if your second door, etc. It can all be set in a chain on Begin Play if like. I’d recommend keeping your door names and variable names similar so you can easily distinguish them later

So with that info, use the setup I showed you and plug in your location variables.

For the overlap events, you can always filter it by your player. Take the other actor, Get Class, use Equal (Class) and select your player class, and plug the resulting boolean into a Branch. That Branch would come after the overlap event and before the Timeline. That way you can make sure no other objects would interfere. With that logic, you can also do it in reverse; let everything activate it and PREVENT specific classes from doing it with a NOT boolean modifier going into the Branch. You can use OR boolean to add multiple classes for preventing or filtering

Thanks a lot Gage. I used the second variable in chain with first as you said and it worked just fine. I tried so many thing to group it together but I didn’t tried this simple thing… I’m still understanding how all this nodes work, though. Well, thanks again.

No problem! I updated the original answer to correct the mistake I made. If it is working for you, go ahead and mark it as accepted to help out anyone else who may have the same problem.

I’m also happy to help if you need more. But if it’s not related to this question, make a new question and let me know and I’ll check it out :slight_smile:

This may be very sad but I can´t get it working for a normal rotating door. It works for me with timeline - make rot - set actor rotation. But when I rotate the static mesh itself in the level, the door kicks back without animation into the original rotation the first time inputting E. I´ve tried to use your location picture SS1 and transform it to rotation instead of location, but I don´t know which nodes to use exactly, what their names are and how to combine them. I´ve tried now for hours.

Can you please do me a huge favour and post a pic of a setting for my problem (which I believe was yours too, as I understand (english is not my first language))??! =(

I´d be ever so greatful!