WiseSlidingDoor: Sliding Doors

From Valve Developer Community
Jump to: navigation, search

This tutorial was originally created by wisemx.

Ported from SDKnuts.net to VDC by: Pinsplash (talk) 22:24, 27 June 2018 (UTC)


Sliding doors have lots of possibilities:

  • Garage door that raises and lowers.
  • Door that zips open and closed.
  • Two doors that open and close together to form one door.
  • Glass door typical around pools.
  • Pocket doors found in home construction.

(I’ve built pocket doors and glass sliding doors in my house, they’re all great.)

You can create any of those with the same methods we’ll use here. In this tutorial we’re going to build a simple door that opens quickly straight up and then closes to its original position. There are lots of ways to build a door and give it the appearance of riding on a track. Not all sliding doors have two tracks, some only need one that bears the weight of the door and keeps it from being unstable. If you build the edges of your door into the walls you won’t even need to simulate tracks in most cases, up to you. My point in mentioning this now is it will be a lot easier to design and build your door and their surroundings with each in mind.

The door for this sample will have these characteristics:

  • Taller than the player.
  • Wider than the outstretched arms of the player.
  • Thin, giving it the appearance of being light but strong.
  • It will open straight up and it will close automatically in 1 second.
  • The door will wait for the player and it will not hurt the player.


Our door begins with a simple brush built with the nodraw texture or covered in the texture you want for your door. The advantage of building it with the nodraw texture is we can use the Face Edit tool to apply any of the various door textures in the SDK and use other textures for the sides and bottom. In most cases the top can remain textured with nodraw.

The brush for our door is 130 units wide, 144 tall and 8 units thick. Press Ctrl+T and tie this brush to entity func_door then click Apply.

Set these properties for the door:

  • Name: Door01 (We give it a name so it can be referenced in our triggers.)
  • Speed: 220 (This is very fast; your doors will typically have a speed of 100)
  • Start Sound: doors\doormove2.wav
  • Stop Sound: doors\default_stop.wav
  • Delay Before Reset: 1 (We want it to close quickly)
  • Lip: 0
  • Blocking Damage: 0 (Change this to hurt or kill a player as the door closes.)
  • Force Closed: Yes
  • Move Direction: -90 0 0
  • Flags: Touch Opens

The door will now work perfectly. When the player touches the door, bumps into it, the door will open, it will wait 1 second and close. If the player doesn’t move out of the way it will rest on their head and when they do move it will close.

We can make this door a little better by creating trigger_multiple entities and placing them on each side of the door. Instead of the player needing to bump into the door they will cause the same toggle action for our door sooner and the player won’t need to stop or even slow down; the door will open for them and close behind them automatically.

Notice in this shot from Hammer how I’ve created two additional brushes and tied them to entity trigger_multiple, then I’ve placed them on either side of our door. I've applied the trigger texture to the brush.

WiseSlidingDoor triggers.png

These are the setting for both:

  • Start Disabled: No
  • Delay Before Reset: 2
  • Flags: Clients
  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch Door01 Toggle 0.00 No

Do the same for both triggers. You can also use the Copy and Paste buttons in the outputs section and you can create the output for both at the same time by holding Ctrl and clicking on both to select them and then press Alt+ Enter.

There are lots of ways to toggle a door like this, with gun shots, buttons or any sort of logic you may need in your maps. This door toggles open and closed but it can be changed to open and stay open, to open and close via buttons, etc. A nice effect with this method would be two identical doors that meet in the middle of a doorway and open to each side when the player comes to them and then they would close again. I’m sure you’ll come up with something.

See Also