Cutscenes Part 2: Splines and Camera Movement

From The DarkMod Wiki
Revision as of 16:47, 3 September 2010 by Grayman (talk | contribs) (→‎Splines)
Jump to navigationJump to search

NOTE: This article is under construction until this NOTE goes away.


Splines

Moving cameras can add a nice touch to a scene if not overused. Splines provide a path a camera can follow.

Download the file [snitch2.zip.txt], remove the ".txt" from the filename, and extract it into your darkmod folder. This includes our Snitch set with all the cameras we created in Part 1.

The first shot we want to create is to have the camera slowly rise from the porch to the south of the bulletin board while pointed in the direction of the bulletin board. To accomplish this, we'll need to add a func_splinemover, which holds a spline (NURBS curve), a func_mover, a func_cameraview, a target_null, and, of course, a script function to bring everything together.

Since the next part is a bit tricky, we'll spell out each step.

  • Open snitch2.map in Dark Radiant.
  • Create a 16x16x16 brush sitting on the porch south of the bulletin board (in front of the tall door).
  • Texture it with NODRAW.
  • Select it and make it a func_splinemover (Click the right mouse button, Create entity, darkmod/func/func_splinemover). This will hold a path for our camera to follow, so we need to define that path.
  • Change its name to "Splinemover5" ("name" "Splinemover5").
  • With Splinemover5 selected, hit the Change views button (the XYZ button on the main menu) three times. This centers all views on Splinemover5.
  • From the main menu, select Curve->Create NURBS Curve. This creates a spline (NURBS) curve with the same origin as Splinemover5.

At this point, Splinemover5 and the spline curve should look like this:

Splinemover5 and its spline

Now we have to move the spline's curve data into Splinemover5.

  • Select the spline anywhere along its curve.
  • In the Entity window, select the Property curve_Nurbs. This property will appear in the field below with the green checkmark on the right.
  • Hit ESC and select Splinemover5.
  • Click on the green arrow. This transfers the spline curve to Splinemover5, which is where we want it.
  • Hide Splinemover5.
  • Delete the spline.
  • Unhide Splinemover5.

At this point, Splinemover5 looks like the previous picture, only now it's holding the spline data.

Movement along this spline will begin at its origin and follow its path. At the moment, the path curves away from the origin in the XY plane. Since we want the camera to rise straight up, we need to change the spline path so it goes straight up from the spline's origin.

  • With Splinemover5 selected, press V to enter Vector mode. Two green dots will appear along the path. These are control points, and we're going to adjust them.
  • In the YZ view, drag the leftmost control point so it's 16 units directly above the spline's origin. You might need to set the grid size to 1 to do this. Note how the dashed line of the path changes when you do this.
  • Drag the rightmost control point so it's 48 units above the spline's origin.

In the camera view, the spline's path has changed, but it's still a curve, so we have to make two more adjustments.

  • In the XY view, drag both control points so they're directly over the origin, and the spline path is finished.
Splinemover5 Halfway There
Splinemover5 Finished

Camera Movement

Create a func_mover

Splinemover5 provides the path our camera will follow, but we need a func_mover to provide the movement.

Create a 16x16x16 brush above Splinemover5 and texture it with NODRAW.

Select it, make it a func_mover (Click the right mouse button, Create entity, darkmod/func/Movers/func_mover), and give it these Property/Value pairs:

  • "name" "Mover5"
  • "cinematic" "1"

We'll discuss the cinematic property below.

Create Camera5

Splinemover5, Mover5, and Camera5

Create a func_cameraview above Mover5 and give it these Property/Value pairs:

  • "name" "Camera5"
  • "trigger" "1"
  • "bind" "Mover5"

The bind property allows Camera5 to follow Mover5 as Mover5 follows the spline.