Camera Documentation
The camera can be interfaced through either the in game camera system as well as from the scripting language.
To spawn a camera from script use the following command:
spawn Camera targetname MyCamera
Switching between cameras is accomplished with these commands:
cuecamera cameraName [switchTime]
Switch to the specified camera. If switch time is specified and you are not already in camera view, the camera will smoothly transition from the third person camera to this camera
cueplayer [switchTime]
Switch back to third person mode. If switchtime is specified, than camera will switch over that period of time.
Other useful scripting commands for cinematics:
freezeplayer
Freezes the player wherever he is standing
releaseplayer
Release the player after he has been frozen
fakeplayer
Create a fake version of the player, hide the real one. The fake player has a targetname of "fakeplayer"
removefakeplayer
Remove the fake player and unhide the real one
The ingame camera system utilizes the following commands:
cam new
Start a new camera path
cam load [filename]
Loads the camera path from cams/[filename].cam. If no filename is set, filename is taken from the cam_filename CVAR.
cam save [filename]
Saves the current path to cams/[filename].cam. If the targetname of the path has not been set, then it is set the same as [filename]. If no filename is set, filename is taken from the cam_filename CVAR.
cam savemap [filename]
Saves the current path to cams/[filename].map. This is a special format for integration into existing map files.
cam setpath targetname
Changes the current path to the path with the specified targetname.
cam settargetname targetname
Sets the targetname of the current path point [targetname].
cam settarget target
Sets the target of the current path point to [target]. Doing this will cause the entity with the targetname of [target] to be triggered when the camera reaches this path point.
cam setthread threadname
Sets the thread of the current path point to [threadname]. Doing this will cause the thread [threadname] to be executed when the camera reaches this point.
cam setspeed [speed]
Sets the speed of the camera at this path node. Speed is displayed above the currently selected path point when the path is being drawn. Speed is the number of path points the camera will go through per second, so a speed of 2 makes the camera take ½ a second per path point. Speed defaults to 1. SetSpeed sets the speed on the current node and any nodes added in the future.
cam add
Creates a new path point at the current player location and angle using the current speed.
cam delete
Deletes the currently selected path point. The current node then becomes the path point that was immediately after the path point.
cam replace
Changes the position, angle, and speed of the currently selected path point to that of the player and current speed.
cam moveplayer
Places the player at the position of the current path point. The player’s view remains the same, however.
cam next
Selects the next point in the path.
cam prev
Selects the previous point in the path.
cam show
Displays the current path. The Current path point is draw in yellow with the speed drawn above it. At each node, a coordinate system is drawn to show the orientation. Red is forward, green is right, blue is up. The lines draw between path points to indicate the direction the camera will take.
cam hide
Stops drawing the current path.
cam play
Makes the camera play the path once.
cam play [targetname]
Causes the camera to play the path specified by targetname once.
cam loop
Makes the camera play the path and continuously loop.
cam loop [targetname]
Makes the camera play the path specified by targetname and continuously loop.
cam stop
Stops the camera and switches the view back to the player.
cam watch targetname
Mark the node to tell the camera to watch the specified target when the camera gets to that control point. [targetname] can be one of the reserved keywords path, node or none or it can just be a targetname for a specific entity.
path – Watch the path as we move, in other words look in the direction that we are moving
node – Orient ourselves based off of the orientation in each node, in other words use the stored orientations at each node to determine our view.
none – Do not make any orientations whatsoever, This means that the camera will not change it’s orientation at all.
cam nowatch
Mark the node to tell the camera to stop watching any entities when the camera gets to that control point. Equivalent to "cam watch none"
cam setfov
Set the fov of the current path node
cam setfadetime
Set the fadetime of the current path node
Script commands for the camera are as follows:
All commands must have the targetname of the camera pre-pended.
start
Start the camera moving or watching
pause
Pause the camera along its path.
continue
Resume the camera’s movement
stop
Stop the camera from moving and watching
speed newSpeed
Set the speed of the camera
fov newFov [fadeTime]
Set the fov of the camera and optionally the time over which the fov should transition, default is whatever the camera’s fadetime is set to.
follow targetEntity [targetWatchEntity]
Start following an entity, if that entity is a splinepath then the path will be followed. If targetWatchEntity is specified than that entity will be watched while following targetEntity. By default targetEntity will be watched as well.
follow_distance followDistance
Distance at which the camera should follow an entity, also used for orbit radius.
follow_yaw yawOffset
Yaw offset of the camera following an entity
follow_yaw_absolute
Make the follow yaw absolute rather than relative to the follow entity’s angles
follow_yaw_relative
Make the follow yaw relative to the follow entitiy’s angles
orbit targetEntity [targetWatchEntity]
Start orbiting an entity, if that entity is a splinepath then the path will be followed and looped. If targetWatchEntity is specified than that entity will be watched while following targetEntity. By default targetEntity will be watched as well.
orbit_height newHeight
Height offset for orbiting an entity
watch watchEntity [fadeTime]
Start watching an entity, and optionally the time over which the transition should occur. The default transition time is the camera’s fadetime.
watchpath [fadeTime]
Start looking along the direction of movement and optionally the time over which the transition should occur. The default transition time is the camera’s fadetime.
watchnode [fadeTime]
Start basing the camera’s orientation off of what is stored in the camera path nodes and optionally the time over which the transition should occur. The default transition time is the camera’s fadetime.
nowatch [fadeTime]
Stop watching an entity, looking along a path or anything else. The camera’s orientation is now static. Optionally transition overt the time specified. The default transition time is the camera’s fadetime.
lookat targetEntity
Immediately make the camera look at the given entity
turnto newAngles
Immediately turn the camera to the desired angles. NewAngles is a vector
moveto targetEntity
Immediately move the camera to the targetEntity’s origin
movetopos newPosition
Immediately move to the specified world space position
fadetime newFadetime
Specifiy a new fadetime for this camera, this fadetime will be used for any of the watch or follow commands if no explicit fadetime is specified.
cut
Switch cameras immediately, don’t transition over time
nextcamera cameraName
Next camera to use in a security camera system arrangement
setthread threadName
Sets the thread of the camera which is accessed from a trigger_camerause