Matinee and Moments

From BiaSDK
Jump to: navigation, search

Example : Making P47's Fly Overhead

This next section of the tutorial is going to run through the basics of using Matinee in the editor, we will be making a P47 fighter plane come swooping down overhead, with some explosions going off on the ground. Matinee was used quite a bit in BIA EIB, both for moving and cutting between cameras, or moving physical objects in the world around.

Step 1 - Scene Manager

The Matinee window can be accessed by clicking on the MOV icon on the left toolbar, after clicking it a new window comes up with 4 tabs across the top. Currently there are no Scenes, so click on the Add New Scene button.

Now we have a new SceneManager to work with, select it (the only one in the list), and then expand Events, change Tag to SCENE_P47_A.

Scroll down a bit, and expand SceneManager, set the property Affect to AFFECT_Actor, we need to select an Actor to use for the AffectedActor property, so lets add a P47 StaticMesh into the map. To do this, open the Static Mesh browser, and then File -> Open, select the package s_military_us.usx. After it loads, choose the Vehicle category from the drop down list (or click All to view all meshes), find the mesh called us_p47_low and select it. We should add it into our map, placed under the terrain.

Once it's been placed, open its properties (f4), expand Events and give it a Tag of SM_P47_A, then expand Advanced and set the property bStatic to False. That way it can actually get moved by Matinee. Now you can also expand Lighting and set these properties:

bShadowCast = False bStaticLighting = False bSpecialLit = True

Then expand AmbientColor and set AmbientBrightness to 130.

So it will only be lit dynamically, and only by the sunlight actor in the skybox (special lit), also the AmbientBrightness tweak will help make it look better.

OK! Now we can open Matinee again, and set the AffectedActor to this StaticMesh. To do this, first have the P47 selected, then click on the None next to AffectedActor, and click Use. It should automatically fill in with the StaticMesh Object name.

Now its time to add a couple interpolation points that designate where our plane should fly. There are actually 2 placed in the level for reference.

Step 2 - Laying Interpolation Points

InterpolationPoints are used for guiding the camera or actor around in our level, they can be found in the Actor Class Browser, in the right column, scroll down and select InterpolationPoint.

Now right click somewhere around where you placed your P47 in the skybox, and add a new InterpolationPoint, you will probably have to move it vertically so that it is somewhere above the skybox ground.

We will just be duplicating this InterpolationPoint to add more, but before doing that lets do a cool trick that helps with animating our plane....

Open the InterpolationPoints properties, and expand Display, look for the property StaticMesh, it should be None, lets change it to StaticMesh 's_military_us.Vehicle.us_p47_low' -just copy and paste that text, then hit enter.

Now look for DrawType, it should currently be set to DT_Sprite, we need to select from the drop down list ST_StaticMesh.

Nice! Your InterpolationPoint should now look like a P47. (they won’t show up in game though, so no worries)

Time to move this InterpolationPoint to a good starting position... There are already a couple pre-placed ones in the skybox that you can use for reference if you like. (or just use the existing ones, Edit -> Search For Actors…)

After moving the first one, do a CTRL W to duplicate it, and move it to the desired end location. We're just going to use two InterpolationPoints to keep things simple, although matinee allows for very complex stuff.

Step 3 - Connect the Dots

Back in the Matinee window, select the SceneManager so that it's highlighted, now click on the Actions tab. Actions are used for telling the camera (or actor) to either Pause, or Move.

Let’s add a new action, by clicking on the Add New Action button, and selecting ActionPause from the list.

Click the Action button again and this time select ActionMoveCamera.

There should be two actions in the list now, select the first one with the Pause icon, expand MatAction and now select your first InterpolationPoint in the skybox.. now for the Property IntPoint, click None and then Use, it should switch to the InterpolationPoint's Object name.

Do the same for the MoveCamera action, except this time select the end InterpolationPoint. After doing this, you should see that a line has been drawn connecting both InterpolationPoints, currently a Linear PathStyle is being used, but it needs to be Bezier for a more natural swooping motion.

With the MoveCamera action still selected, expand Path, and set PathStyle to PATHSTYLE_Bezier. You may not see a change, but zoom in on one of the InterpolationPoints and you will notice a "handle" coming off it, depending on how we move these handles (called Control Points) we can alter the curve of the path.

The first thing to do is make sure an InterpolationPoint is selected, then click on the Control Point, it should highlight green, now you can move it the way you would normally move other objects in the editor.

We need to tweak the spline path between the 2 interpolation points, it should run diagonally across our skybox, with a slight curve…

Now to give the scene some length, normally you would just edit each MoveCamera's Duration property, found under Time, but that makes it hard to make a plane look like it's flying at the same speed through the whole scene if there are multiple MoveCamera actions... So we will use a ConstantPathVelocity, where instead of inputting the time it takes for something to get from point A to B, we just input the speed (calculated in 1 unreal unit per second it seems).

With our MoveCamera action selected, Expand Path, and set bConstantPathVelocity to True, now set PathVelocity to 17000.0

After doing this, our Time for the ActionMoveCamera should have automatically changed to 10.0 seconds or so (we want it about 10 seconds). If we were to add more InterpolationPoints, we would use the same PathVelocity to keep our plane moving at a steady speed (or we could even have it accelerate etc)

To preview how our scene will look, you simply need to click on the Open A Preview Window button, then a Matinee Preview window will open, click play and you will fly through from the plane's viewpoint.

You may notice that the camera isn't rotating and banking to match how your InterpolationPoints are rotated, this can be fixed using the SubActions tab.

SubActions are whole sets of other Actions which are called when their owner Action is called.. basically can be thought of Actions as the Parents, and SubActions are children.

Select our ActionPause camera, and then click the Sub Actions tab, click the Add New Sub Action button , and select SubActionOrientation. There are also other options, for changing the FOV, shaking the camera, slowing down time.. etc.

With our new Orientation SubAction selected, expand Orientation, then expand CamOrientation, and change CamOrientation to CAMORIENT_Interpolate, you can also experiment with the other orientations to see what gives the best result. Now our starting point will blend with the ending point and look a bit nicer.

Step 4 - Pulling it together

We're going to make a new TriggeredScript that will handle the P47, we could simply just set up a trigger to trigger our SCENE_P47_A, but using a TriggeredScript will allow us to time it with sound effects, explosions and whatever else.

Create a TriggeredScript TS_P47_Scene, add these lines to it:

State Triggered
ACTION_PlayLocalSound( "V_PLANE.C47_PASSBY" );

Now make sure to compile changed, and place it in the level.

You will need to place a gbxTrigger also, the gbxTrigger should have a Tag of TRIG_C47_A and an Event of TS_C47_Scene. Set the gbxTrigger to HumanPlayerProximity and TriggerOnceOnly True. After creating the new trigger, expand Advanced and set bHidden to False, then expand Display and set DrawScale to 3. This will change the size of our trigger’s icon, and also make it visible in-game. Expand Collision and set the CollisionHeight to 256 and CollisionRadius to 128.

Step 5 - Big Explosion, whoosh!

For this next step we're going to add some gbxExplosionTriggers, open the Actor Class Browser and scroll down in the right column, select gbxExplosionTrigger. Now drop one into the level somewhere out in the open and change its Tag to EXP_Bomb_01.

With the property inspector still open, expand the gbxExplosionTrigger (below Events), and change ExplosionClass to MortarExplosionDefault (from the drop down list). You can choose another ExplosionClass if you like, there are tons to select from, although not all will work as expected! Change ShakeRadius to 11000.0.

You can also alter properties relating to damage, damage radius, Offsets (controls the camera shake) etc.. But the default settings work pretty well for what we are doing.

Now duplicate (ctrl w) this gbxExplosionTrigger a few times, and place them around spread out, after duplicating be sure to go through and increment the number in each Tag. We will be triggering these in our TS_P47_Scene script.

Add the following lines to TS_P47_Scene script, after the PlayLocalSound. I just used 4 gbxExplosionTriggers, depending how many you made you will have to add or remove some lines.


Now when testing the map, when you walk into the visible trigger, the P47 should swoop down bombing the area across from you.... cool, But let’s adds more!

Step 6 - AnimPawn Birds

We are going to add a new actor to our level, an AnimPawn. AnimPawn's are similar to regular characters (pawns), but in the way that ScriptedControllers are "dumber" than Minds, AnimPawns are "dumber" than ScriptedControllers; They do not have any AI at all, but can be used for playing animations (the main purpose) and using some Pawn specific commands on.

So, let’s start this by adding an AnimPawn to our level, from the right column of the Actor Class Browser. This has the potential to be tricky, when you place the AnimPawn in the level, you will notice that nothing actually shows up, just a red arrow.. so before selecting any other object, hit F4 to bring up the Property Inspector.

Under Events, change its Tag to AP_Birds, now expand Display, and scroll down to Mesh. type in k_animal.crow_b Then hit enter.. your AnimPawn should turn into a mesh of birds sitting in a row. If it didn’t, you probably need to open the k_animal Package with the Animation Browser.

The mesh being referenced can be viewed in the Animation Browser, it's found inside the K_animal package, and there are 3 meshes, crow_a, b and c. Other common-use examples of AnimPawns are in k_prop and k_vehicle_. Even US or German soldiers can be AnimPawns, you would just set their mesh to whatever is in the Mesh dropdown list inside the Animation Package. Now expand AnimPawn, change MeshAnim to k_animal.crow_b_anim This is just setting up what Animation Set to use. After that, expand AI, and set ControllerClass to ScriptedController, so that we can use our usual animation commands.

These birds are going to be placed off beyond one of the hedgerows, similar to the image above, they will fly off as the plane goes overhead. To setup the animations we need to add some more lines to our TS_P47_Scene script, using some of the same commands as in our intro.

add these 2 after the 4.5 second sleep.

ACTION_SetAnimSet( 'AP_Birds', "k_animal.crow_b_anim" );
ACTION_PlayAnim( 'AP_Birds', 'a_takeoff_long', 0.2, 1.0, False );

then add these 2 at the end of the script.

sleep( 3.0 );\\
ACTION_DestroyActor( 'SM_P47_A' );
Sleep( 17.0 ); ACTION_DestroyActor( 'AP_Birds' );

We are destroying the P47 after it flies over, and then also the birds, as their animation is roughly 20 seconds long. This could have been a nice spot to use ACTION_WaitForAnimEnd( pawnTag, 0 ); which halts the script until the Pawn is done playing the current animation, but I just used sleeps instead to keep things simple.

Back to Main Page