Check out Half-Life Re-imagined competition results!
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to akn, our newest member!

Azure

15

Cobalt

32

Turquoise

10

Cyan

11

Royal

9

Teal

3

6 secs

UrbaNebula

1 mins

Mr Gnang

5 mins

akn

10 mins

16 mins

Screamernail

16 mins

Dr. Orange

26 mins

Windawz

# Perfect Timing with Doors

Page: [1] 2

## Tutorials > Half-Life > Intermediate > Perfect Timing with Doors

By Instant Mix (More from this user)
28th December, 2011
Intermediate
distance , speed , doors , trains

# Perfect Timing with Doors - Page 1

Doors. Who doesn't love them? They can come in all shapes and sizes : standard rotating , sliding , even hexagonal doors! But have you ever had that time where your doors just don't cooperate? One closing before the other? One being completely out of sync? Well , here is a relatively simple way to fix that.

### The Problem

The problem is caused by two ( or more ) doors of different lengths moving at different speeds.Because they are different lengths , the shorter / faster door will close before the other and leave an OCD-inducing time gap.

To fix this problem , we need to use some maths to find the speeds at which doors will shut at the same time.

### The Solution

The root of the solution to this problem is the incredibly simple equation :
D = S*T
If you haven't seen this before , this is known as the DST formula ( Distance , Speed , Time ).
It allows you to figure out the duration , speed and distance an object moves or takes to move if you know the other 2 variables.

We will be using this derivative equation in this tutorial to do our work:
S = (D-LIP)/T

You can also use this equation to find out the time a door will take to open in case some variables are unknown to you.
T = (D-LIP)/S

### The Method

For each func_door:
Find the length of your door in the direction it is moving , and the Lip value you have put in , if there is any.

Decide on a duration for the door - 5 seconds , 1 second , maybe even half of a second

S = (D-LIP)/T

For each func_door , divide the found length minus the door's lip by your chosen time. Set the func_door's speeds to these value , and both doors should shut at the same time.

### EXAMPLE ON NEXT PAGE

Daubster says: 28th December 2011, 14:51 PM
I like how you've included a detailed example on how it all works, good stuff!
DiscoStu says: 28th December 2011, 22:56 PM
Nice. Simple and to the point. Didn't learn anything new, though :P
Tetsu0 says: 28th December 2011, 23:52 PM
Horray for math!
Nice Tut - Simple, easy to follow.
I used to not care about door timings, but now that i dont have to think for myself, i'm gonna apply it :)
Captain Terror says: 29th December 2011, 02:45 AM
this is really well done, and way faster than trial and error trying to match up the door speeds! Great work sir!
SpaG says: 31st December 2011, 08:50 AM
Now the only problem that remains, is calculating door height relative to the direction it will move, when doors move on a plane, or two axis (say, diagonally). Add more complex door shapes and you're better off guessing the timing :-D
Anyway, god work.
Instant Mix says: 8th January 2012, 14:25 PM
I was going to add that in Spag but then I thought nobody would need it. Now that you've brought it up , I might just.
Stojke says: 22nd February 2012, 21:50 PM
Awesome! Really nice tutorial, 5 stars mate.
ciba43 says: 17th May 2013, 20:59 PM
Greatd tutorial :D
BshiftCalhoun says: 26th May 2016, 23:24 PM
a more simplier way is putting a trigger_multiple next to the doors and make them big enough so the player doesnt reach the doors before it start opening (thats if you dont want to block on the doors when youre running)
BshiftCalhoun says: 29th May 2016, 21:52 PM
nvm what i just said it has nothing to do with the tutorial my bad
You must be logged in to comment.