Unreal Engine: Sliding Door (A Step-by-Step Blueprint Tutorial)

In game development, creating interactive environments that respond to player actions is essential for creating an immersive experience. One way to achieve this in Unreal Engine is by adding a sliding door, which can be used to create a sense of suspense, hide secrets, or simply add a layer of interactivity to the game.

Making a sliding door in Unreal Engine can initially look difficult, but it’s much simpler than you might expect.

In this blog post, I’ll walk you through the process of making a sliding door in Unreal Engine using Blueprints. We’ll begin by creating the door, and then adding collision and animation.

By the end of this tutorial, you’ll have a basic understanding of how to create a sliding door in Unreal Engine and be ready to add more interactivity to your game world. So, let’s get started!

Getting Started with Unreal Engine

Step 1: Create a Player

You will need a playable character in order to follow this tutorial. Feel free to use the first person or third person Unreal Engine templates if your project doesn’t already have one.

Unreal Engine 5 Project Template

Step 2: Create the Door Frame

  • You can create a basic door frame just by adding cubes to your level. For this example, I only used three cubes to make the door frame.
  • The 2 cubes that make up the door frame’s sides have a Scale value of “3.0” on the Z-axis.
  • The cube on top of the door frame have a Scale value of “2.0” on the Z-axis and is rotated “90.0º” on the X-axis.
Create a Door Frame in Unreal Engine

Step 3: Create a Blueprint Actor for the Sliding Door

  • In the Content Browser, click “+ Add“, or right-click in an empty area, and select “Blueprint Class” from the menu.
  • In the “Pick Parent Class” Pop-up window, select “Actor“.
  • Now give a name to your Blueprint Actor. For this tutorial I’m going to name it “BP_SlidingDoor“.
Blueprint Actor

Step 4: Create the Sliding Door in Unreal Engine

  • To create a Static Mesh for the door simply click “+Add” in the Components Panel and select the “StaticMesh” component.
  • To choose the 3D object you’d like to use as the door, go to the Static Mesh Dropdown Menu in the Details panel and select “SM_Cube,” or any other 3D asset of your preference.
  • If you downloaded or created a door in a 3D Modeling Software like Blender, you can import it to Unreal Engine by just right-clicking anywhere in the Content Browser and selecting the first option “Import to /Game…”.
Create Sliding Door

Step 5: Door Opening Area (Box Collision)

  • The next step is to specify the area where the door will open when the player enters. Imagine it as a sensor on a typical store door. How near and where must the player be for the door to open?
  • Click “+Add” once again in the Components Panel and now choose the “Box Collision” component to specify the door opening zone.
  • Using the Transform tools in the Details Panel, scale the Box Collision to a proper size.
  • Tip: If you only put the Box Collision on one side of the door, the door will only open from that side. But if you make the Box Collision big enough to cover both the front and back sides of the door, the door will open when the player enters from either side.
  • In the Details Panel, go to “Collision → Collision Presets” and in the dropdown menu, select “Trigger“.
  • Finally, right-click on the Box Collision and choose “Add Event → Add OnComponentBeginOverlap“. This will let us generate a Blueprint Script that moves the door to the side when the player enters the Box Collision.

Step 6: Blueprint Visual Scripting

  • Now you should now be in the Event Graph tab and see a red node with the name “On Component Begin Overlap (ActorName)” if you followed this tutorial correctly.
  • Right Click and “Cast to…” your Player Character Blueprint.
  • Right Click and select “Set Relative Location (Your Door Mesh)“.
  • In the parameter “New Location” set the Y Value to 100. If you wish to move the door in a different direction, you can also just input the value on a different axis.
  • Link each of the Blueprint’s nodes as shown in the image below.
  • Tip: Drag and drop the Door Blueprint to your level and test it before moving on. When the player approaches the door, now it should move.
Blueprints for a Sliding Door in Unreal Engine

Step 7: Making the door move smoothly (Timeline)

  • Create a Timeline using the node “Add Timeline…” between the “Cast to” and the “Set Relative Location” nodes.
  • Click on “+ Track” and select “Add Vector Track“.
  • Hide the X and Z tracks and Lock them.
  • Right click on the Timeline and select “Add key to Y“. Then enter the following values “Time: 0, Value: 0“.
  • Repeat the last step and create a second key, this time “Time: 1, Value: 100“.
    • Tip: Change the time value to a higher value, such as 2 seconds rather than 1, if you want the animation to last longer. Set a value higher than 100 to move the door further away.
  • Select both keyframes you just created, right-click and select “Break“. This will smooth the animation.
  • Finally, change the value Length: 1.
  • Connect the vector track pin (yellow), to “New Location“, as shown in the image below.
  • The sliding door should now open as intended.

Step 8: Closing the door (On Component End Overlap)

  • Simply repeat step 5’s final step and create a “On Component End Overlap” event to complete this tutorial and make the door close.
  • Copy the “Cast To…” Blueprint and connect the execute output to the “Reverse” Input of the Timeline.
  • The result should be exactly like in the image below:

Step 9: Congratulations, you created a Sliding Door in Unreal Engine!

  • Drag & drop the Blueprint you created to your level and test it. Now the door should open and close, congratulations!
  • If you want a double slide door, simply duplicate the Blueprint and rotate it 180 degrees on the Z axis.
  • After completing the tutorial, this should be the outcome:
Unreal Engine Sliding Door Tutorial

Extra: Double Sliding Door

  • To further enhance your skills with Unreal Engine, you can challenge yourself by creating a double sliding door on the same blueprint.
  • You can achieve this by simply utilizing the information and the blueprints we used in this tutorial, as you can see in the image below.
Create a Double Sliding Door in Unreal Engine

Hope This Helps! Keep On Creating!