Point_viewcontrol

Point_camera entities display a camera view on a screen like a television. You, the player, can still walk around and interact with the world while a point_camera entity is active. Point_viewcontrol entities, by contrast, take over the player's view. The player can still walk around with a point_viewcontrol entity active, but there is always the option (flag) to freeze the player so they can't walk or look around. These cameras can be told to always look at a specific entity or even the player. Point_viewcontrols entities can even move along a path like a train. Point_viewcontrol entities are perfect for cutscenes, so let's make one!

The example map ch8_viewcontrol has a prebuilt and prescripted entity setup for your reference in this section. In the example map, the level fades in as the camera moves towards a house. When the camera nears the door, it opens to reveal a dead zombie. After scoping out the room, the camera stops at our players' view and we attain control.

The camera

After we create our environment, the first order of business is to place a point_viewcontrol and set it up to follow a target. After that's done, we can work on tweaking camera movement and creating our other triggers.

We're first going to create a track train, so make an 8 x 8 x 8 func_tracktrain and name it camera_target. The camera is going to be pointing at this train, but we don't want it to be visible, so set its Render Mode to don't render. The next thing we need to do is create a path for our camera to look at; basically a sequence of points of interest where our train will travel to.

Create a path_track entity and name it camera_target_path01. Copy the path_track entity twice (by holding Shift and dragging it) to create camera_target_path02 and camera_target_path03. Set the func_tracktrain's first_stop_target to camera_target_path01.

Now that our camera target and path are set up, let's move on to the camera itself. Place a point_viewcontrol entity in the map and name it camera01. In the entity to look at field, type in camera_target so our camera will always look at the func_tracktrain entity we have just created.

The camera

In the point_viewcontrol properties, set the flags Freeze Player and Infinite Hold Time to make sure the player cannot move when the camera is activated and that the camera will stay on until triggered off. Keep all other flags off. Compile the map, run it, and then open the console.

Since we haven't set up any triggers yet, nothing is going to happen, but we can use a console command to control entities as a test. The ent_fire command can fire any input of any entity. It can also change render modes, kill entities, and much more. It's a powerful tool that you should spend some time playing with. In this example, we will see how our train functions without the need to interact with triggers.

The camera

Type the following commands into the console:

Ent_fire camera01 enable
Ent_fire camera_target startforward

The first command activates the camera and the second command makes the train move forward. Once the camera is activated, you have no control over your movement or view. This is why we're using the ent_fire command to test our entity setup. When the second command is sent, the view will change because an active point_viewcontrol entity is pointed to a moving func_tracktrain entity.

Tip

You'll notice that after you type ent_fire, a list of entities in the map appears in the drop-down list. After you select an entity, all commands related to that entity appear in the drop-down list. If you place a named entity in a map, you can fire different outputs from the console to see what will happen. It's a great learning and troubleshooting tool.

Now that we have the camera activated properly and we are looking at the track train, let's create a path for our camera to travel along.

The camera path

Unlike func_tracktrains, point_viewcontrols do not follow path_track entities; they follow path_corners. Thankfully, the path_corners function is the same as path_tracks, so you already know how to create and link them together.

The camera path

Create a series of path_corners entities that will snake around your map and end at an info_player_start entity. Place the last path_corner entity inside the middle of an info_player_start entity, 64 units off the ground. Our goal is to blend the camera movement into the player view as though the camera is moving through the back of the player's head. We want no noticeable difference between the camera view and the player view once the sequence is complete.

The camera path

Open the properties of the last path_corner entity. Create the following output:

OnPass > camera01 > disable > 0.50s Delay

Each path_corner (and path_track) entity will fire the OnPass output when an object reaches it. In this case, we want to disable the camera for half a second after it reaches the last path_corner entity. With some tweaking, there should be no notable difference in view when the point_camera entity turns off.

The speed at which the point_viewcontrol entity travels is specified by the initial speed parameter in the properties. You can control the speed of the point_viewcontrol entity by putting a non-zero value into the new train speed parameter in any path_corner. The camera will start moving as soon as it's activated; 50 (units per second) is a good starting value.

Tying it all together

So now we have a camera that moves along a path while looking at a target that is also moving along a path. Syncing the two train timings can prove difficult, so to save time and possible frustration, we're going to cheat. We're not really cheating, but since there are multiple ways of accomplishing the same task, the easiest way is usually the best.

Instead of playing with track_train speeds, we're going to make the track train jump, or teleport, from focus point to focus point. We'll do this by firing outputs at certain points in the camera's path. Check the teleport to this path_track flag for each node in the camera_target's path in order to make that teleport happen. Add the following output to each path_track so the track train doesn't keep teleporting away:

OnPass > camera_target > Stop > 0.00s delay

When the camera target entity reaches this point, it will stop moving.

Whenever you want the viewcontrol entity to focus on something else, fire an output from one of the path_corners that will start the camera_target tracktrain entity.

Select a path_corner entity on the camera's path, and add the following output:

OnPass > camera_target > StartForward > 0.00s delay

Because each path_track tells the camera_target entity to teleport, you will instantly change the camera's target to the next path_track entity.The camera will pan smoothly between path_tracks. Compile the map to check out the results!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.26.217