Prerequisites:
The Basics
Summary:
Ever wonder how to get Jock's black helicopter to take off after a mission?
Or how the little boat in the Hong Kong canals was set up to move around? The
answer is "Interpolation Points". While that may sound scary
or technical, they are just items that you add to your map to define paths for
objects to follow. You can set up a sequence of these (numbered 0 through
whatever) and the Unreal engine will fill in ("interpolate") points
in between to make the motion nice and smooth. In this tutorial,
we'll make the little Hong Kong boat move around in a circle.
Download example map (36K) - walk toward the boat and it will start moving along some interpolation points
NOTE: Getting Jock's helicopter to take off after a mission (or something similar) is beyond the scope of this tutorial, but understanding interpolation points is the most important step. Stay tuned for a MapExit tutorial that fully explains how to transition from one map to another with a "cinematic".
You can use anything you want, but for this example, let's move a boat around. Under Actor -> Decoration -> DeusExDecoration -> HongKongDecoration select HKTukTuk, and add it to a map. If you don't have any water in your map, you can choose something else, such as the BlackHelicopter or Van, though it doesn't really matter too much.
Pull up the HKTukTuk's properties and set its Events -> Tag value to Boat.
In the Class browser under Actors -> Keypoint, select InterpolationPoint. Now start placing InterpolationPoint's to define where the boat will go. They look like this: in the editor. Don't be skimpy with them - the example map I made uses 35 of them. The more points you have, the more accurately you'll be able to shape the path the way you want. I used three InterpolationPoint's for most of the turns.
I would recommend adding InterpolationPoint's very close to each other for the first three points. Otherwise you'll get some weird jerky motion when the object starts moving.
Set each InterpolationPoint's Events -> Tag value to Boat. Set the first point's InterpolationPoint -> Position value to zero, the second one to 1, and so on. The RateModifier can be used to speed up or slow down the object as it moves through a particular point. Higher values cause the object to go faster.
Once you have placed the points roughly where you want them (don't bother tweaking until they are all placed), rotate them so that the red arrow points in the direction you want the boat to go. It's not quite as simple as that though.
While the arrow is a good guideline, the way to see what kind of movement you're really going to get is to look at the sets of red, blue, and green lines that are displayed along the motion path. When you click on any InterpolationPoint of a path, the path itself will display as a white line, and a number of "axis" markers will display along the path. Each "axis marker" shows how the object's pitch, bank, and heading (or, in Unreal-speak, pitch, roll, and yaw) will change as it moves along the motion path. You'll notice that the motion path doesn't necessarily pass through each interpolation point; each point only has an *influence* on the motion path.
NOTE: If you're defining the path of a flying object, like the helicopter, it's helpful to realize that you can move and rotate the InterpolationPoint's any way you want to in three dimensions. The red arrows can be used to control the pitch, bank, and heading of the object you are moving.
Pull up the properties of the final interpolation point and set its InterpolationPoint -> bEndOfPath to True. Also, set InterpolationPoint -> bSkipNextPath to True, since we want the motion to start over again each time the boat completes its path.
You'll notice in my example map that the boat does a little reverse loop at the end. That's because by the end of the path, the boat has rotated 360 degrees. If that little loop to spin the boat back around was not done, when the loop repeats, the boat would have quickly rotated from 360 degrees back to zero. It's a bit hard to explain, so you may need to experiment to fully understand that. Anyway, if you look at the 06_HongKong_WanChai_Canal.dx map, and look at the path of the moving boat (the boat is hard to miss with all those red lines coming out of it), you'l see that it does a large "figure 8". That allows the boat the cover a large area while neaty avoiding the "spin out at the end of the path" issue.
In order to get the boat moving, we'll have to use a trigger. Under Actor -> Triggers -> Trigger, select InterpolateTrigger and add one to your map where the player will be able to walk. Set its Events -> Event value to Boat. You can also bump up the Collision -> CollisionRadius if you want a larger radius.
Now when the player walks within the collision radius of the trigger, the boat will start its motion. It may look weird at first, so now's the time to tweak to your heart's content.
NOTE: You can also fire an InterpolateTrigger from a ConEdit trigger event, from a mission script, or from another trigger such as a Dispatcher. That last option is useful when doing end-of-level cinematics using the MapExit item.