# Knowledge Base - Moving Camera

## Moving Camera

Figure 1: Camera Moving Along Path

The moving camera is, as the name implies, a camera that moves along a predetermined path. The movement is quite smooth and is perfect for creating those cut scenes found in most games today. The sample wad, movecam.wad illustrates the use of the camera.

The moving camera (9072) takes four parameters:

1. low byte: low byte of tid of first InterpolationPoint in path.
2. high byte: high byte of tid of first InterpolationPoint in path.
3. options: (Add any of the following values; i.e. for options 2 and 4, this parameter would be 6):
• 1: path is linear instead of curved.
• 2: Camera will adjust its angle to match those of the points it passes.
• 4: Camera will adjust its pitch to match those of the points it passes.
• 8: When used with 2 and/or 4, the camera faces in the direction of movement instead of the direction the InterpolationPoints are facing.
• 128: Every player will see the camera's view, and not just the player who activates it.
4. tid: Tid of thing to look at (or 0). If specified, settings 2, 4, and 8 in the third parameter are ignored.

The moving camera uses a set of Interpolation points (9070) that define a path to follow. They operate similar to the pathnode of a monster patrol route.

1. pitch: pitch of camera in degrees, 0 is straight ahead, 1-89 is down, and 166-255 is up (angle subtracted from 256).
2. time: time (in octics) to travel to next node.
3. pause: time (in octics) to stop at this node before continuing
4. low byte: low byte of tid of next InterpolationPoint in the path.
5. high byte: high byte of tid of next InterpolationPoint in the path.

Parameter 4 has the low byte, and parameter 5 has the high byte, so the tid is parm4+(parm5*256). This lets you use more than 255 points for all paths. For example, if the next point had a tid of 4 then the low byte is 4 and the high byte is 0.

In addition, there is now a SymbioticPoint (9075) that will activate when any InterpolationPoint with its same TID is used by any of the moving objects (MovingCamera, PathFollwer or ActorMover). The thing special for the SymbioticPoint will be triggered. It will be repeatable, so if you only want it to trigger once, handle that in scripting.

Figure 2 shows a sample layout of interpolation points:

Figure 2: Camera Moving Along path

The camera in the example is activated by a switch which in turn calls a script that executes the Thing_Activate and ChangeCamera specials.

The Thing_Activate takes a single parameter, the tid of the thing to activate.

The ChangeCamera special has three parameters:

1. tag: The camera tid.
2. who: 0 if the view only changes for the player activating the special, 1 if all player views change.
3. revert: 1 for the view reverts back to player when player moves.

To stop a moving camera use Thing_Deactivate. Thing_Deactivate takes one parameter, the tid of the thing to deactivate. If the camera is restarted using Thing_Activate, it will automatically start at the beginning of the path. You can use ChangeCamera as often as you like to view the camera.

### Sources

ZDoom reference by Marisa Heit.

Back