Tutorial: trigger_camera Last edited 2 months ago2019-04-23 07:20:10 UTC by Penguinboy Penguinboy

Before you read this tutorial, make sure you have the latest version of Half-Life.

Remember the part in the original Half-Life where Gordon was captured by grunts? There was a little 'movie' of the grunts supposedly dragging Gordon. Well that was achieved with a trigger_camera and a tight setup. In this tut, I will try and explain how to use the trigger_camera, hopefully in a simple way!
That 'lil Half-Life momentThat 'lil Half-Life moment

Introduction

The trigger_camera is essentially a func_train. It has to follow a set of path_corners, has options for speed and can also be set to target something (more on this later). There are varying ways of setting up a trigger_camera. This depends on what type of 'movie' you would like to do. We'll try a simple one for now.

Simple

Create a room. Place an info_player_start in it as well as a trigger_camera and some lights. Create a trigger_once by creating a brush textured with the AAATRIGGER texture, hitting 'To Entity' and then selecting 'trigger_once'. Go to the trigger_camera properties. Set these options: Now for the trigger_once. Put the player in it so it activates straight away. Take a look at the properties for the trigger and set these options:

1. Target - This would be the name of the camera. So if your camera is named 'cam1' put 'cam1' into this field.

That's it! Run the map and you will notice that you're looking at Gordon. When you move around the camera will follow you.
The finished productThe finished product
Simple and easy? Yes. Good looking? No. Right now your little movie looks pretty bad. The camera can't move from its point apart from moving on its axis. It's also very boring. Time to spice it up! From here on it gets harder so pay attention!

Advanced

For this part, we will try and make a camera that follows a path. For this section, you will need to know how to use a multi_manager as well as a func_train and path_corners.

First, create a better looking room as I'm sure you wouldn't want your movie to consist of looking at grey walls. Put some things in it, chairs, desks, etc to make it interesting. Now for this to work, the camera has to look at something or more accurately an entity. This could be anything. This is what would happen:

The camera would travel along the path whilst looking at the object you told it to look at. Here's where the func_train comes in. The func_train can follow the same track as the camera! Set the trigger_camera to look at the train and voila: it now looks as if the camera is looking at its path. So how do you do this?

Set up a path of path_corners. This is what the train and the camera will be following. The more path_corners you have (especially on turns) the smoother the camera will be. Take a look at the each of the path_corners properties and set these: Now for the train. Make a small cube, textured with the '{BLUE' texture. Place an origin brush in the centre of it and tie them together. Then hit 'To Entity' and select a 'func_train'. Now for the properties: Last but not least the trigger_camera: Now it's all set up. But hold your horses we aren't done yet! You will need a multi_manager to get it up and running. Multi_managers are great. They are very versatile and best of all, very simple to use. First put a multi_manager into your map. Take a look at its properties: All that needs to be done is setup the multi_manager. For this example, the func_train will be called traincam1; the trigger_camera will be called cam1 and the multi_manager will be called cammm ("cam multimanger" if you can't figure it out). Take off SmartEdit and add this to it:

Name traincam1
Value 1

Name cam1
Value 1.5
A neat and tidy entity setup. Setting it up similar to this makes it easier to see where things are and how things flow.A neat and tidy entity setup. Setting it up similar to this makes it easier to see where things are and how things flow.
So what does that mean? Well it means that 'traincam1' will be activated 1 second after the multi_manager has been activated and 'cam1' will be activated 1.5 seconds after the multi_manager has been activated. Make sure that trigger_once you put in before now targets the multi_manager (cammm). But wait! Gordon's in the way of the camera!

This is where it gets a little tricky. The trigger_camera has to 'see' Gordon somehow. This isn't the same as the 'Target' field. But what if you don't want to see Gordon at all? What if it's a cut scene like the one in Half-Life? There are a few solutions:

1. Place Gordon in a place in your map so that the camera doesn't see him.

This method would work if you didn't care where Gordon was when the camera reverted back to him. Not so good if you do care.

2. Shove Gordon in a wall

This method would work if your making a movie only and don't need to revert back to Gordon. If you do, it's pretty pointless.

3. Teleportin'

Warning, this is tricky. It involves a lot of entity setups. I'll only give the basic gist of it here. Here's the plan:

Build a small room outside of the main area and texture it black. Put the info_player_start in there. Now you will need to setup a teleport (see Tutorial: Teleporters) that will teleport Gordon into the main room, start the camera and teleport him back to the place you want after the 'movie' has finished. Now your thinking "What a fool, the player will see the teleport!" This is where some handy env_fades come in. Add the env_fade to the multi_manager and the level will 'fade in'. If you put enough delay in, you can teleport the player in, start the train and camera, teleport him out and fade in to the moving camera! A little tricky but quite effective.

4. Func_wall

Trigger_cameras can 'see through' func_walls. In essence you could put Gordon in a room close to the map, make the walls func_walls and start the camera.

Notes

Well that wasn't too hard was it? By now you should have a camera running on a track. You want more? Well here are a few ideas: There are a couple of good examples in the Map Vault by BJ:
Loading embedded content: Vault Item #1885
Loading embedded content: Vault Item #1889

7 Comments

Commented 7 years ago2011-12-08 17:08:25 UTC Comment #100675
Just what I was looking for. Never really learnt the trigger_cameras, but now I have.
Commented 6 years ago2013-02-04 01:37:52 UTC Comment #100676
I get a little bug. When my camera travels thru paths (p1, p2, p3..) it suddenly goes slower and backwards (Without reaching next path), after few seconds it goes normally again - forward and with normal speed. I can't understand why this happens :/
Commented 6 years ago2013-02-04 02:03:30 UTC Comment #100677
Ok.. Got it right now :)
If You set speed on paths, do not set speed on camera.
Commented 3 years ago2016-05-20 04:33:02 UTC Comment #100678
ah so the multi_manager is an entitity to trigger more than one thing? i always used multiple trigger_once or trigger_multiple and put all of them in the same location
Commented 1 year ago2018-02-05 12:52:27 UTC Comment #100679
my camera does not along the path_corner.
I can see it tracking the train though.
Commented 1 year ago2018-02-05 13:06:59 UTC Comment #100680
fixed I changed the start acceleration speed.

Thanks for the Tutorial!
Commented 3 months ago2019-03-31 13:55:40 UTC Comment #101937
Hi, I've tried the first lines of this tutorial about trigger_camera. In JACK the info_player looks like Gordon with his special outfit but when I run the map, in the camera sight the player has the Gman outfit ? I'm afraid Half-Life grants identity theft !! Is it normale like a joke of the devellopers ?

You must log in to post a comment. You can login or register a new account.