Point camera

Point_camera entities project an image onto a monitor. These can be useful to simulate a TV broadcast, video call, or security camera system. There are three main parts to a point_camera system:

  • Camera (point_camera)
  • Monitor (any brush-based entity)
  • Camera link (info_camera_link)

The point_camera entity is the actual camera. You simply give it a name and aim it at whatever target you want it to look at. The monitor is a special texture that will display the point_camera's image, and the info_camera_link entity specifies which camera is displayed onto the monitor texture. Let's walk through creating a simple security system.

Create a two-room map with a light in each room. In one room, place a point_camera entity and something for it to look at. Name the point_camera entity sec_cam01 and click on the look at button to easily set the camera's target. In my example, I have the camera looking at an npc_antlion.

Point camera

In the other room, place an info_player_start entity and a television-sized brush. Texture the brush with the halflife/black texture and tie it to a func_detail entity. In front of the black brush, place another brush with a monitor texture on the front, such as dev_tvmonitor1a. Fit the monitor texture to the front of the brush, and texture every other side with the nodraw texture so the image appears only on the front. Tie this monitor brush to a func_brush entity and name it monitor_screen.

Tip

Unlike a func_detail entity, a func_brush entity allows us to assign a name, which we require in order to link the camera to the monitor.

Your television should look somewhat similar to a modern flat screen television:

Point camera

Now to tie everything together, place an info_camera_link point entity in the room. Set the Entity Whose Material Uses_rt_camera field to the func_brush entity name (monitor_screen in this case) and set the camera name field to the name of the camera, sec_cam01. Name the info_camera_link entity camera_link.

Point camera

You're all set! Now, when you compile and run the map, you will see an image of an ant lion on the wall.

Point camera

A one-camera security system isn't that impressive. How about we add another?

Multiple cameras

The info_camera_link entity has the ability to change which camera is forwarded to a monitor by passing the setcamera input. Create another room with a second point_camera entity in it. Name the second camera sec_cam02. Create a func_button entity in the control room (the room with the monitor in it). Set the button's delay before reset field to -1, and set the toggle flag so the button needs to be pressed in, and then manually "pulled" out. Give the func_button entity the following outputs:

OnIn > camera_link > SetCamera > sec_cam02 > 0.00s Delay
OnOut > camera_link > SetCamera > sec_cam01 > 0.00s Delay

When the button is pushed in, the camera link uses sec_cam02 as the display camera, and when the button is pulled out, the camera link uses sec_cam01 as the display camera.

Panning the camera

We can get even fancier with our security camera by parenting a point_camera entity to a func_door_rotating entity to make our camera pan across a room. Create a small brush behind the point_camera sec_cam02 entity and tie it to a func_door_rotating entity. Name the func_door_rotating entity sec_cam02_pan and assign it the following outputs:

OnFullyOpen > sec_cam02_pan > Close > 2.00s Delay
OnFullyClosed > sec_cam02_pan > Open > 2.00s Delay

So when the door is fully open, it will wait for two seconds and then close. Likewise, when the door is fully closed, two seconds will pass and it will open again. Because the point_camera entity is parented to the func_door_rotating entity, the camera will rotate with it, and look across the room.

Panning the camera

By controlling the speed (in degrees per second) and distance (in degrees) parameters of the func_door_rotating entity, you can fine-tune the coverage characteristics of your security camera.

The outputs we just noted will fire continuously for as long as the map is loaded. However, when the map spawns, the door is in a dormant, closed state and will not fire the OnFullyClosed output. We need to manually set things in motion, so place a logic_auto entity next to the func_door_rotating entity and give it the following output:

OnMapSpawn > sec_cam02_pan > Open > 0.00s Delay
Panning the camera

Now that the door is being initialized, it can rely on the outputs to pan indefinitely.

Using these techniques, you can even parent a point_camera entity to an NPC for a simulated first person view of whatever that NPC sees. The possibilities are nearly endless.

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

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