The largest collection of Counter-Strike maps online.
Rotating Cameras.
Cameras Part II.
Rotating Cameras? Yes, they are possible! It look as if they're surveying the area and look very nice in game and helps to give a 'professional look' to your map.
Well, here's how to do it:
Ok first things first, make the camera model and the camera entity. Ill be using the same as in the Simple Camera tutorial, and the same values used in the fields (i.e. cam1, etc).
The main difference now between the 'simple camera' and the rotating one, is that no info_targets are used.
Lets go:
Ok, ill assume that you have got the camera set-up and if using the same camera as the 'simple camera' tutorial, then delete the info_target entity, and move the trigger_camera entity out of the way for now. Also, select the camera and click on the button 'To World'. We no longer need the camera as a func_wall.
Next thing, create a brush with the ORIGIN texture. The origin texture is only used for rotating objects, so we'll need one. Now, move the origin brush over the camera and where you want the camera to rotate about. You should have something like this:
Don't worry about the origin brush going straight through the camera, it doesn't appear in game. Also, note that I've set the origin brush in the same place as the support. This is the centre of where it will rotate from.
Now, select the camera and the origin brush (not the supports), and press Ctrl + t. This will tie them to an entity. Select 'func_pendulum' from the drop down list.
Then, set-up the entity as follows:
* Distance - This is the amount of degrees that you want the camera to rotate, so 90 for looking up 2 corridors (if its set at the corner of both)
* Speed - Set this to 40 or 50, we want the security camera to be moving slowly don't we!
We also need to set some flags, these being:
* Start On - This makes the camera start rotating as soon as the level is loaded
* Passable - Stops the player from interfering with its movement
* Auto-return - Makes the camera move back and fourth, very important!
Now, we need to set-up what the camera will actually look at. Since we want it to be moving, then info_target will not be what we want. We will be needing an object that moves from one position and back again. For this, we need a func_train.
Make another origin brush and also another block (any shape, it doesn't matter). This will be made invisible, so you won't have a block moving in the air in your map!
Something like this:
Note that it doesn't matter what it looks like, you just need something to be the func_train!
Now, select the origin brush and the 'block' and press Ctrl + t. From the list, choose func_train. It needs to have the following attributes and flags set:
Name - This is what the camera will target. I'm going to use 'rotcam_targ'.
Render Mode - We need it invisible, so choose TEXTURE from the box.
FX Amount (1-255) - Set this to 0 for it to be invisible.
First Stop Target - This is the first place that the func_train will move to. We will set-up a path_corner entity in a minute. Fill in this field the name of the path_corner, i.e. train1
Speed - I've used 100 for my cameras, however, you may want to adjust this for your maps.
Damage on Crush - Set this to zero, in case some low gravity has been set and someone gets gibbed for flying through it!
There's only one flag to be set, and that's 'Not Solid'. Click on it.
Now, we need to set up two places where the func_train will move too.
Make two entities, and turn them both into 'path_corner'. Now, select one of them and fill in these attributes:
Name - Set this to train1 (specified in the func_train as the first stop target)
Next Stop Target - Set this to train2
Do the same for the other path_corner entity, but reverse the information (name and next stop target should be opposite of the path_corner just set up).
Now, move these path_corner entities to where you want the camera to move between. Think of them as an info_target, where you want the camera to view.
Its easiest shown in a picture:
Here, the camera is located at the corner of two corridors. The light orange cubes are the path_corner entities. This is the two targets that the func_train will move between, i.e. allowing for the camera to view down two corridors, one at a time.
The button has been left from the simple camera tutorial, so you may have to create or edit it to allow for the rotating camera.
Also, note that the func_train will move through the wall to get to its target, so don't worry about any walls getting in the way.
We now have to set-up the camera entity. Set an entity just in front of the camera (so that when viewing through it, none of the camera is visible). Set the entity as a trigger_camera and then set its properties up as follows:
Name - I'm using cam1
Target - The name of the func_train, in this case rotcam_targ
One last entity to go! We want the func_train to start moving from when the map is loaded. To do this, insert an entity and change it to a 'trigger_auto'.
Only one property needs to be set here:
Target - The name of the func_train, in this case rotcam_targ
Also, make the two camera supports into a func_wall to help reduce r_speeds (see SmdBlink_182's tutorial on r_speeds for more info)
We now have a working, rotating camera! All that's left to do now is to set-up the button that views the camera entity. Do this in exactly the same way as the simple camera tutorial, making the func_button target the trigger_camera. Watch, as the camera's view moves!
An extra that can be done is to make an animating texture that shows the cameras view and put it on the func_button. I may post a tutorial on animating textures later on.