Lab 2
Summary
This lab goes through the Kismet and Matinee System. In it you will create a door that is set to open if a user runs into a trigger and close after it.
Learning Outcomes
Learn how to hook up a simple kismet and matinee system
Submission Requirements
Once complete, show your work to Cathy or Hasan
Instructions
Add a mesh for the door
If you are adding a mesh that will move as part of a kismet matinee sequence you cannot add it as a regular static mesh as it will not be able to move. Instead you will need to add it as an InterpActor. This is done in the same way as adding a regular static mesh except that you will need to choose a different menu item.
Notice that the mesh outline in the orthographic viewports are shown in pink and not blueSetting up mesh properties
Select the mesh and right click to bring up the interpActor properities dialog box. In that dialog box choose the following settings:
- In the Collision Tab, change the collision type to COLLIDE_BlockAll
- In the DynamicSMActor tab expand the StaticMeshComponent--> Lighting make sure the bCastDynamicShadow is unchecked
If your mesh looks black (instead of showing the texture) you will also need to turn on the lighting.
- In the DynamicSMActor tab expand the LightEnvironment category. Expand the LightEnvironmentComponent and make sure bEnabled is checked.
- Right click in your map and choose Add Actor --> Add Trigger from the context menu. A light switch icon should now show up on your map.
Adding the Trigger
To see how what the collision box looks like hit the c key.
to change the size open the Trigger's property dialog box,
Trigger Tab-->CylinderComponent category and edit the CollisionHeight
and CollisionRadius values.
Kismet
Although the trigger and interpActor are in the scene you still need to hook them up so that when someone hits the trigger, the interpActor moves.
To do this we must now set up the Kismet/Matinee sequence.
Opening the Kismet Editor
Hit the Kismet button on the toolbar (
Select the Trigger from your map and in the kismet ediotr window right click and choose New Event Using Trigger_0 --> Touch (or whatever your trigger's name is... you can find this out by selecting the object in the map. Its name will show up at the bottom status bar). This means that when the trigger is touched or untouched the associated matinee (we have not made this yet) will be played.
You may also wish to change the MaxTriggerCount so that it works more than once (the default is 1). To do this change the value for MaxTriggerCount to 0. You will also note that if you did everything properly your kismet object shows the actor it is associated with and also shows how the trigger will get activated. Below is a picture of what you should see if you did this part properly.
Matinee
Matinee is a sequence that can play once some even occurs. Think of it as a short animation.
Creating the Matinee object
To build a matinee object with your InterpActor do the following
- Select the InterpActor in your map.
- Right click in the Kismet editor window in an area to the right of the kismet object and choose new Matinee.
Connecting the Matinee object to a Kismet Object
- Drag a line between the touch and Play nodes of the kismet/matinee objects
- Drag a second line between the untouch and Reverse nodes of the objects.
What this means is that when the object is touched, the Matinee animation will play When the object is untouched the animation will play in reverse.
Creating the Matinee Sequence
A Matinee sequence is like an animation. It gets played on trigger of some event as defined by the kismet object it is attached to. To create the animation:
- Ensure that your InterpActor is Selected at this point!
- Double click on the Matinee Object.
- Right click in the area under the All/Camera/Skeletal mesh button on the left and choose new empty group from the context menu
- Type in text for the group name in the popup box. For example movingdoors.
- Right click on the box that has your group name you netered in the previous step and choose new movement track
Creating the actual animation
Animation is done by setting a series of key frames. The actor will move based on its position change from its position in one keyframe to the next. You can set up multiple keyframes to make it look more interessting (a door that sputters and stalls before opening for example) but in this example we will simply add one key frame with the door in the open position.
Grab the timer bar and drag it to the 1 second mark or however long you think the door should take to open The timmer bar is circle in the image below. .
At the one second mark, indicate that it is a key position by hitting the key button in the button bar of the matinee editor window. Ensure that you have the movement track you want selected (click where it says Movement) before doing this.
If you did it properly the word Key1 will now be on the left of the matinee window and there will be an orange triangle at your 1 second line. Click to select that orange triangle. In your map, you should see the words "Adjust Key 1" in each of your view ports. Pick the viewport that will be best suited to make your adjustment and move your door to its open position.
Close the kismet/matinee windows
Save, build and that should pretty much work.