Chapter X. Doors.

Door construction: sliding, rotating, glass, and valve-operated door types.

10.1

Sliding and Rotating Doors

In this article we will tell you how doors that slide to the side and rotate are created. We will also look at ways to open doors using buttons and triggers. Before reading the article, we recommend that you familiarize yourself with the following entity objects:

1. Sliding doors

The easiest way to make a door that slides to the side. We will start with this type of door.
Activate, i.e. There are several ways to open a sliding door, here are the main ones:
– by touching the door or pressing "Use" (default "E")
– button
– trigger
a) opening the door by touching
Let's say we want to create a door in this opening (see figure below). To do this, select a suitable door texture (for example, C1A0B_DR4A) and build a brush equal in size to the opening. It should be noted that the standard door sizes in Half-Life are 96x64x8 (i.e. 96 units in height, 64 in width and 4 or 8 in thickness). Naturally, this is not a strict rule.
Creating a door
Now select the brush and transform it [Ctrl-T] to an entity object func_door. The door is ready! All that remains is to determine its properties, such as: direction and speed of movement, sounds when moving and stopping, time before automatic closing, etc.
Angle — the direction of movement of the door is indicated here. To determine it correctly, set the view to the top (2D top), then movement to the left will correspond to 180°, to the right - 0°. If you want the door to go up or down, select from the list Up or Down respectively;
Speed — door movement speed (default 100, normal speed);
Move Sound — sound when the door moves, you don't have to specify it;
Stop Sound — the sound of the door stopping, also optional;
Delay before close — time in seconds during which the door will be open, then it will automatically close. If you want the door not to close, set the value "-1" here or check "Toggle" in the flags (see below). By default, the door closes after 4 seconds.
Health (shoot open) - "strength" of the door. If you specify a value greater than zero (> 0), the door will open only after the specified value of damage has been caused to it. For example, if you specify Health = 100, then the door will open after 4-5 shots from the machine gun. Default value is 0.
Lip — with this parameter you can change the distance at which the door opens. By default, the door opens to its width, i.e. If the door is 64 units wide, then it will open 64 units. The formula is very simple: Distance = (Door width - Lip), i.e. if parameter Lip positive, then the door will open to a distance less than its width, and if negative, then, accordingly, to a greater distance.
What is Lip used for? When the door opens completely, its visible side coincides with the wall into which the door was slid, which creates a not very beautiful effect (try it :). If you set the Lip parameter to, say, 2 units, then the door will look out from the wall by 2 units, and there will no longer be an ugly effect.
The remaining parameters are not so important.
Now let's look at the flags.
Starts Open - check this flag if you want the door to be open at the start of the round
Passable — it will be possible to pass through the door (hardly necessary for a normal door)
Toggle - if the door has a name, then it can be opened and closed using a button or trigger (see below). A door with the Toggle flag set will not close automatically
Use Only - if checked, the door will open only when you press "Use" (the default button is "E").
b) opening the door by pressing a button
The door discussed above opens when touched. Let us now consider the opening of a door by pressing a button.
Make exactly the same door. The only difference between this door and the one discussed above will be the presence name (Name). In order for the door to be opened with a button, it must be given a name, for example, sliding_door1.
Now let's make the button itself. Our button will be a brush with dimensions of 12x12x4 units (see figure below), painted with texture +0BUTTON1 and located on the wall next to the door. Naturally, a simple brush won't work, so let's turn it [Ctrl-T] into the button func_button.
Create a button that, when clicked, will open the door
The properties of the button in this case are very simple:
Targetted object — sliding_door1 (here we indicate that when the button is pressed, a door named sliding_door1 will be opened)
Delay before reset — time in seconds during which the button will not operate after it has been pressed. Default: 3 seconds, can be set to 0.
Flags:
Don't Move — if you check this flag, the button will not be pressed into the wall, but the door will still be activated. Naturally, if you want, you can not check this flag, but then you will need to indicate in the "Angle" parameter the direction of movement (pressing) of the button, speed, etc.
c) opening the door by passing through the trigger
Triggers are invisible in the game. When a player passes through a trigger, the object specified in its properties is activated. We use this opportunity to open the door.
So, we already have a door. Let's call her sliding_door2. Now let's create a brush painted with a special texture AAATrigger and place it in the center of the door (see figure below).
Create a trigger that, when activated, will open the door
The brush needs to be made slightly larger than the door so that the player touches it on either side of the door (see the top (x/y) view in the figure above).
Select the brush and click [Ctrl-T], select trigger_multiple from the list. This type of trigger allows you to activate an object multiple times.
Let's set the properties of the trigger.
Target — sliding_door2 (the name of the door that the trigger will open is indicated here);
Delay before reset — time in seconds during which the trigger will not work after it has been activated. The default is 10 seconds, but in our case with the door, a value of 0 would be best, so that the door will always open when the player passes through the trigger.
Delay before trigger — time in seconds before the object is activated (before the door opens). For example, if you specify 5 seconds here, the door will only open 5 seconds after the player passes the trigger. It is better to set the door to 0 seconds so that the door opens instantly, without delay.
The remaining parameters can be left unchanged. That's it - the door is ready. When the player passes through the trigger (and it doesn't matter which side, because the trigger "looks out" from both sides of the door), the door will open.

2. Revolving doors

Revolving doors are a little more difficult to make and have more properties, but that's okay :)
a) opening the door by touching
Make a brush that will be the door.
Since the door (in this case) is a rotating object, it is necessary to determine the axis of rotation for it. This is done using ORIGIN brush, i.e. brush on all sides painted with a special ORIGIN texture.
Must be placed correctly ORIGIN brush, because This determines how the door will rotate. So that when opening the door does not "drive" into the wall, ORIGIN brush should be positioned in the top view as shown in the figure below.
Determining the location of the ORIGIN brush
Please note that the center of the ORIGIN brush is located in the middle of the thickness of the door (visible in the top view), and the distance from the edge of the door to this center is equal to half the thickness of the door. The dimensions of the ORIGIN brush do not matter. It could be a very small brush, or it could be a big one.
Select the door (for now the door is a simple brush) and the ORIGIN brush (while selecting, hold down the Ctrl key), press [Ctrl-T] and select from the list func_door_rotating. The door is ready! All that remains to be done is to determine the door rotation parameters. Most of the parameters coincide with the parameters of the func_door sliding door, so we will consider only the new ones.
Distance (deg) — door rotation angle in degrees. By default, the door rotates 90 degrees, which is quite normal.
Now let's look at the flags.
Starts Open - if checked, the door will be open at the beginning of the round;
Reverse Dir — by default the door opens "from the player"; if you check this flag, it will open "towards the player". In the case of a button or trigger opening the door, this flag simply reverses the direction of the door opening;
Passable - if checked, you can walk through the door freely;
One-way — the door will open only in one direction (regardless of which side the player approaches it from);
Toggle - if the door has a name and is opened by a button or trigger, then it will not automatically close. To close the door, you will need to press the button again or go through the trigger;
X-Axis, Y-Axis — these flags determine the axis around which the door will rotate. By default, if you do not check anything, the door rotates around the vertical Z axis, i.e. as usual. You can read more about choosing the axis of rotation in the article Rotating Light. This article discusses the principle of determining the axis of rotation, which can be applied to any rotating object;
Use Only — if you check this flag, the door will open only by pressing "Use" (the default button is "E").
b) opening the door from a button or trigger
The methods for creating an opening door from a button and from a trigger are absolutely the same as for a sliding door, so we will not describe them again. The only thing is, do not forget to include the ORIGIN brush in the revolving door and correctly determine its location.
doors.zip [37Kb] - in the archive there is an example map in BSP and RMF formats.
10.2

Glass Doors

In this article we will look at creating doors with glass, both sliding and rotating. We assume that you have mastered the creation of ordinary doors of these two types, and also understood the principle of operation of the trigger_multiple trigger.

1. Sliding doors with glass

Again, as with regular doors, a sliding door with glass is easier to make than a revolving door, so we'll start with that type.
Why can't we just make a door with a glass insert? The fact is that the door should be opaque, and the glass insert, on the contrary, should be transparent. And the same object cannot be transparent in one part and opaque in another. You'll have to resort to some trickery.
We'll actually create two doors: one as a door with a hole, the other as a glass insert. To create the illusion of one door, we will give the doors the same name and activate them simultaneously with the same trigger. So, let's get down to tricking the average player into thinking there is only one door! :)
Let's build a door with dimensions of 96x64x8 units with an opening of 48x36 units. For shading we used texture FIFTIES_DR9. In order for the texture to fit well, we made the thickness (height) of the top beam of the door 6 units, and the two side beams - 8 units each. As a result, our door will consist of 4 separate brushes (see the figure below).
Create a door with a hole
Let's set the following properties:
Name — sliding_door1 (we will use this name to open a door, or rather two doors at the same time with a trigger);
Move sound — pneumatic (sound when the door moves, may not be specified);
Delay before close — 4 (after 4 seconds the door will close automatically);
Lip — "2" (the door will "peek out" from the wall by 2 units in the open position);
Speed — 100 (door movement speed, default);
Also, do not forget to define the correct angle in "Angle", which sets the direction of movement of the door. We got an angle of 0 degrees, because... the door slides to the right in the top view.
The first door is ready. Now we will make the second (transparent in the game) door (see figure below). We will use texture GLASSGREEN (almost black in the picture). The dimensions of the second glass door are naturally equal to the dimensions of the opening. In our case, 48x36x8 units.
Create a second (glass) door
Set exactly the same properties as for the first door (i.e. the same angle, the same name sliding_door1, delay before close: 4, speed: 100). The remaining properties should be changed.
Move sound — No sound (we don't need the second sound of the door opening - it is already set for the first door);
Render Mode — Texture (this mode is necessary for the glass to become transparent);
FX Amount — 80 (the closer the value is to 0, the more transparent the glass, and vice versa, the closer to 255, the more opaque);
Lip "-14" (minus 14);
Why exactly this Lip? Since the width of the doors is different, the Lip should be different. For a glass door it should be larger (i.e. negative). If Lip at a glass door is negative, then it will move further than the distance of its width.
We need to specify such a Lip for the glass door so that it slides into the wall and does not change its position in relation to the main door. Look at the picture below.
t9glassdoor4 This is the view from above. Black is the main door ("frame"), pink is the internal glass door, gray is the wall. So, the required Lip will be equal to the distance with the question mark minus Lip of the main door ("frame").
Now you need to make a trigger that will activate both doors at the same time (see figure below). We use for this trigger_multiple, as is the case with simple doors.
Place a trigger to activate both doors at the same time
In the properties of the trigger in "Target", write down the name of the doors (it is the same), and also set "Delay before reset": 0.
The sliding door with glass is ready!

2. Revolving doors with glass

The principle of constructing revolving doors with glass is exactly the same. The main difficulty lies in correctly determining the location ORIGIN brushes.
In the picture below you can see a door consisting of 7 brushes and having 2 holes for glass (note: such a door can be made from 5 brushes, but this is not important). The dimensions of the door, as in the first case, are 96x64x8 units, the thickness of the "frame" is 8 units everywhere.
Since the door is revolving, it is necessary to determine ORIGIN brush center of rotation. We placed the ORIGIN brush in the upper half of the door (see figure below). This is done for convenience - at the bottom there will be an ORIGIN brush of the glass (internal) door.
Create a door with two holes and determine the position of the ORIGIN brush
In the top view you can clearly see the position of the center of the ORIGIN brush (see figure below). With this arrangement, the door will open correctly in both directions without driving into the wall (jamb). The arrows show both doors: the inner glass (we haven't made it yet) and the outer ("frame").
t9glassdoor6 To make a door, select all 7 brushes and the ORIGIN brush while holding Ctrl. Then click [Ctrl-T] and select from the list func_door_rotating.
Let's set the following properties for the door:
Name — rotating_door1 (we will use this name to open a door, or rather two doors at the same time with a trigger);
Move sound — vacuum (sound when the door moves, may not be specified);
Delay before close — 4 (after 4 seconds the door will close automatically);
Distance (deg) — 90 (door rotation angle);
Speed — 100 (door movement speed, default);
Now let's create a second (glass) door (see figure below). It will consist of 2 separate brushes with hole sizes (in our case, the holes are the same - 48x36 units each). ORIGIN brush We will place it at the bottom of the door and in the top view (see figure above) it is compatible with the first ORIGIN brush. This must be done because the axes of rotation must coincide.
Create a second (glass) revolving door
Select both the glass brushes and the ORIGIN brush and also transform [Ctrl-T] V func_door_rotating. Give the second door the exact same name as the first, i.e. rotating_door1. Set the speed, rotation angle and time until closing to the same.
Now the differences:
Move sound — No sound (we don't need the second sound of the door opening - it is already set for the first door);
Render Mode — Texture (this mode is necessary for the glass to become transparent);
FX Amount — 80 (the closer the value is to 0, the more transparent the glass and, conversely, the closer to 255, the more opaque).
All that's left to do is build trigger_multiple, as in the first case. In the properties, in the "Target" parameter, enter the name of both doors (it is the same): rotating_door1, and also set "Delay before reset": 0 (so that the trigger is "reset to zero" instantly).
The second door is ready! When passing through the trigger, both doors will open in the same direction, at the same speed, and close the same way after 4 seconds.
Do not forget to change the parameters for both doors symmetrically, otherwise synchronization will be lost. Well, as always, if something remains unclear, you can always download our example map. The archive contains both the map source in RMF format and the already compiled BSP map.
glassdoor.zip [21Kb] - in the archive there is an example map in BSP and RMF formats.
10.3

Valve-Operated Doors (momentary_door)

In this article, we'll look at creating doors that open as the player spins a valve, and automatically begin to close when the player stops spinning. To create such doors, we need two new entity objects: Door momentary_door different from the sliding door we already know func_door only in that it can only be opened by an object momentary_rot_button. The object itself momentary_rot_button is a rotating valve that activates an object (in our case, opens a door) gradually while it itself is activated (rotating).
So, let's make a garage door that will rise up from the rotation of the valve. We will place the valve on the wall of the garage (see figure below).
Create a momentary_door door and a momenatry_rot_button valve
The door is made in exactly the same way as the most ordinary door sliding to the side, only after pressing [Ctrl-T] in the list you must select momentary_door instead of func_door. The properties of the door are exactly the same as those of func_door. Below are the main parameters that we set in the test card.
Name — mom_door1 (we will use this name to open the door by turning the valve);
Angle — up (the door goes up);
Speed — 35 (door speed, low);
Lip "24" (after lifting, the door will protrude from the vertical wall by 24 units).
You can also set some sounds when the door moves and stops. Let's leave the rest of the parameters as they are.
Flags:
Toggle - if you check this flag, the door will automatically lower when the player releases the valve.
We've sorted out the door, now the valve. A valve can be any object, we made something similar to a real valve using vertex manipulation (see figure below).
Determine the location of the valve rotation axis using the ORIGIN brush
Don't forget when making momentary_rot_button (valve) create an axis of rotation, i.e. ORIGIN brush. We made a rather small ORIGIN brush, extended it along the axis of rotation (for clarity) and placed it exactly in the center of the valve (see figure above).
Once the position of the ORIGIN brush is set, all that remains is to select all the brushes that make up the valve, as well as the ORIGIN brush, and turn it all into momentary_rot_button.
In our example, we set the following properties for momentary_rot_button:
Targetted object — mom_door1 (here we entered the name of the door that the valve will open);
Speed — 30 ​​(valve rotation speed around the axis, small);
Sounds — plunger (sound when the valve rotates);
Distance (deg) — 270 (valve rotation angle, selected arbitrarily, default 90 degrees);
Auto-return speed — 20 (reverse rotation speed of the valve, i.e. when closing the door).
Flags:
Auto Return — when the player releases the valve, it will begin to rotate in the opposite direction;
Y Axis — here the Y axis is defined as the valve rotation axis, because in our example, in the top view, the rotation axis (do not confuse it with the ORIGIN brush, since the ORIGIN brush determines only the center of the rotation axis, and not the direction) is located vertically, and therefore this is the Y axis.
That's it, the button, and with it the whole door is ready.
Naturally, you can use these two objects for more than just doors. You can make a rising bridge or platform, etc. in the same way.
momentary_door.zip [22Kb] - in the archive there is an example map in BSP and RMF formats.