Sliding Door 2D Blueprints Help
Hello. I am creating a level where the player must slide a door from one location to another, but I have no idea how to do the blueprint scripting for this. Below is a screenshot of the level.
Ideally, the player would enter a trigger box that the sliding door has, and then they press or hold a button, and move left or right to slide the door. I have tried playing with attach to actor, but the door teleports when the player looks in the opposite direction. The movement of the door should be constrained to left and right.
Any help with this would be much appreciated.
asked Oct 08 '16 at 12:05 PM in Blueprint Scripting
Ive had a quick stab at this issue, and I came up with a solution, its probably by no means the best solution, but it should help you get what you want. I did it in the 1st Person Example map so it also might have a bit of a different setup than what you need, heres a small video of my solution, if thats what you are looking for, then great - https://www.youtube.com/watch?v=vYUEHiz8NgU&feature=youtu.be
So the first thing I did was set up a 'Door' blueprint. That is a cube with a box collision attached. I created two events which set a variable on the player character to true when overlap, and false when not overlapping.
The next part in the Door blueprint was a Event Tick, which if a variable is set, it goes to a SetActorLocation node. That node is plugged into a make vector, and seeing in your picture that you want your door to move on the Y axis, then I make a FInterpTo node to try and smooth the transition and put that into the make vector. You can see the rest of the setup there, including the two custom events MoveDoor and StopMovingDoor which are called from the player.
The last part is the player character, this is pretty self explanatory, when you are in the range and the CanOpenDoor is set you get all the overlapping door, and then call the event to move the door, which is needed as the door needs to have the location of the player so it can move towards it. And then the rest of it should be simple to set up.
Hopefully that will help you, let me know if you need further help.
answered Oct 08 '16 at 08:06 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here