From the course: Unreal Engine 4: Realtime Motion Graphics

Creating keyframes with the Matinee Editor

From the course: Unreal Engine 4: Realtime Motion Graphics

Start my 1-month free trial

Creating keyframes with the Matinee Editor

- [Voiceover] Now that we have a basic object and camera in the scene, I'm going to show you how to use Matinee, which is the Unreal Editor's animation tool set to now animate this camera in the Editor, itself. So, first, I'm going to take the camera that we've brought in, I'm going to set some settings that I've pre-determined here. So we're going to do a negative 500 on the x for location, zero on the y, and 400 on the z. And then rotation, I'm going to enter a value of negative 10 on the y. Okay, so now we can see, we're just looking down a little bit, and we have this thing framed in our scene. So, what we're going to do, we're going to set up, basically we're going to put this camera under a null, and then rotate that null, which is something we'd do in a normal 3D package quite a bit, as where we wouldn't actually animate the camera, but we'd animate the camera rig. This is an incredibly simple version of a camera rig, but it's just to show you how we can apply some of that knowledge and use that in here. I'm going to go over to my Modes pane, and you can see under the Basic tab, here, we have this Empty Actor, which we can consider a null. Right? So we don't have an object called null; we have an object called Empty Actor. So I'm going to zero out it's location. And I'm also going to go under its Editor Billboard Scale, let me open this up a little bit, and just change that down to zero, 'cause we don't need to actually be able see it, and that's just an easy way just to make it invisible when we're looking at things. So now what we want to do in our World Outliner, we have this thing called Actor. I'm going to rename that, hit F2, and I'm going to call that CAM_CTRL, C-T-R-L. And now our CameraActor, I'm going to hit F2, rename that, I'm going to call that RENDER_CAM, just more my formal nomenclature from working in 3D packages, just applying that same stuff here. So now I'm going to take that RENDER_CAM, put it under the camera control, and so now it's under a null that's at the center of the scene. Really, really basic stuff. What we want to do, is now we want to animate a rotation. Right? So we want to rotate this null 360 on what we would normally consider the y but is actually the z in Unreal land, just so we can rotate around this object. So, what we're going to do is, now, we're going to show you how to add a Matinee object to the scene. So, under Cinematix, I'm going to say Add Matinee. Okay. So now we have a new window that opens up, and it says MatineeActor. Okay, what we're going to do, is let's pull this down, and I'm going to grab this tab and dock it up here so I can go between our scene and our matinee. Because, although this is just another window that opens up, it's kind of a bit of a different program as well, and you'll see what that means in a second. Okay. So the first thing that we want to do is we want to select the CAM_CTRL, and then we want to go to the MatineeActor, and under this Tracks section over here, I'm going to right-click, and I"m going to say Add New Empty Group. I'm going to call that group CAM_CTRL. Now I'm going to right-click on that and say Add New Movement Track. The movement track allows me to animate the rotation and translation scale, all that basic stuff. If I right-click where it says Movement and say Split Translation and Rotation, you can see that now we have our x, y, z for translation and rotation actually out there, so we can understand what's going on. So I'm going to scroll mouse out here, and as you can see, we're looking at the different views of the timeline, different scale. So what I'm going to do is I'm going to grab this little red triangle down here where it says five, and I'm going to drag that out to the right, just to extend our timeline. This light gray area here is length of the sequence we're animating. I'm going to go up to the top here and click on Toggle Snap. If we click on our little triangle again here, you can fell that starts to snap to clean divisions of time. I'm just going to bring it out to 20 seconds. And then I'm going to grab the work area here and extend that out as well. So now we have a bit of a 20-second timeline. Okay, so we want to go back to our CAM_CTRL in our viewport. Everything's obviously zeroed out. Go to our MatineeActor tab, I'm going to scroll my time back to the beginning, I'm going to click on rotation here, where it says rotation so it highlights everything, and I can click Add Key. And you can see that adds a key, then, at time zero. Now I'm going to scroll out to the end here, I'm going to go back over to our tab with our scene, click on our CAM_CTRL, under Rotation z, I'm going to type 360, which would have rotated the camera around, again, what we would have normally considered the y, but it's the vertical axis, 360 degrees. I'm going to go back to the MatineeActor, again, making sure we've rewound to the end, click on Rotation, and type Add Key. So now, I'm actually going to pull the MatineeActor tab out just a little bit just so we can see both windows at the same time, and I'm going to hit Play. So now you can see that we have our camera rotating around our scene 360 degrees over 20 seconds. So this is the basics of how to set key frames with objects in Matinee within the Unreal Editor. There's a few more steps we need to do to be able to play this back, just to do all the under-the-hood setup things to do this properly, so I'm going to show you that now. I'm going to click on our RENDER_CAM. Let me drag our MatineeActor tab back up to the top of the scene here. So I'm going to add a track here for our camera, which is just something we have to do to get all the camera playback stuff set up right. We're going to right-click here, say Add New Camera Group. I'm going to call this RENDER_CAM, underscore cam. Okay. Cool. So because our RENDER_CAM was selected in our Outliner, and because we did that here in Matinee, that camera's connected to that. You just have to make sure to select the right thing in the outliner, and then create the track in Matinee. Now what we need to do is we need to add a director group and a director track. So I'm going to right-click here and say Add New Director Group, and you can see this other Tracks area appears up here, with a Director Group and a Director. Basically, in the simplest way you can think of this, is that this Director basically controls which camera is viewable. Right now, we're just dealing with this one camera, we want to look through this one camera through this whole duration. So we're going to click where it says Directer here, and we're going to hit the Enter key, and this little menu's going to come up. And you can see that we're going to have little options for all the different things we have down here. Now what we want is our RENDER_CAM. I'm going to hit OK. So now on our Director track, you can see that our RENDER_CAM is enabled there for the duration of the shot. Okay. Now I'm going to go back to my viewport, I'm going to click on MatineeActor, and I'm going to say Play on Level Load in the Details area. So what that's going to do is that's going to enable that animation to start, and the Director group to look through that camera when we hit Play. All right, so I'm going to hit Play. And now you can see a message comes up and says 'Play in Editor' must close UnrealMatinee. Continue?, and this where it's kind of interesting. It's almost as if this Matinee window is a separate program that it has to close out to be able to play. It's just a quirk in the way that Unreal Engine works, and you just get you to it, and you say OK, sure. Close the window. And now, we play this back, and we're looking through the camera. We're seeing the animation we animated, and we're seeing everything framed out, everything else going away. Let this play out. Voila. And you can see when we stop, we ended up in this weird place where it looks like we're in the geometry, and we see these weird fragments of things. I'm actually going to hit Esc to get out of the game, and then zoom out. So what happened there, is that when we're in the game, and the Matinee ends, we go back to our default player start position. Obviously this stuff makes no sense what we're doing. We don't have a player, we're not making a video game, but there's just some of these things that we need to keep in mind when we're working in the Unreal Engine. So what we're going to do here, this little cap seal object that you see selected, this is basically the default player start positions. So, number one, we're just going to get this thing out of the way. Just so that when the game ends, it's not in the middle of that geometry. The other thing that we're going to do, is with that selected, we're going to turn on Actor Hidden in Game, 'cause we don't need to see that. Now we're also going to select the MatineeActor and find its Actor Hidden in Game option and turn that on. 'Cause if you saw before, there was some other objects, like there was a little sphere hidden in the bottom of the piece of geometry we had, because the other objects can sometimes be visible, even though they're not actual pieces of geometry, they're just kind of utility objects. Again, just a quirk of working with the system, we need to turn on Actor Hidden in Game. And the final thing we need to do here to make sure once this Matinee sequence that we've animated ends properly, and kind of gets us out of our game state, is to create a very simple command that quits out of the game once the Matinee ends. And we're going to do that in an Unreal system called Blueprints. And, again, this is a huge can of worms that we're not going to get into very much. We're just going to do some very, very simple stuff in here. This is basically a way to do visual scripting with nodes in the Unreal Editor. We're going to use it to do one very simple thing right now. We're going to make sure our MatineeActor is selected in the World Outliner. Now we're going to go under Blueprints here, and we're going to say Open Level Blueprint. And we get yet another window with a bunch of different stuff, and I'm going to dock this up here as well. So now I'm going to right-click on this grid, and you see that automatically it says Create a Matinee Controller for MatineeActor_0. We're going to click on that. And you can see that that has a little output that says Finish. So, clearly, it's going to give some sort of command when that Matinee that we've defined has been finished. So what we want to do is we want to have it quit the game once it's finished. So we're going to right-click, and under our little search field here, we're going to type quit. We're going to have an option here that says Quit Game that comes up, and we're going to click on that, and we're going to drop down this node that says Quit Game. I'm going to drag these down here in the window so we can see this better. And we're going to very simply connect Finished to the input of Quit Game, and that is it. All that's going to say is once the timeline is done, quit out of the game. We're going to close this. So, now, if I hit Play again in our viewport. Ah, you see that sphere, that's one our utility objects that we need to make sure is turned off. Now instead of me having to hit Esc to get out of that game and be in that weird space where we're in the middle of the geometry, once the Matinee animation is finished, it quits the game, puts us back into our Editor mode. So obviously that's a bunch of different technical things that need to be set up in a certain away, from animating our stuff in Matinee to adding the camera in and the director track and the little simple blueprint quit operation, and we'll do these things a bunch of times as we build different examples. 'Cause all of them will use the exact same things. And these are just some basic things you need to know just to be able to cleanly get a nice view of your game while you're playing it. So once we render these things out, we can do that properly, and then just set it up so we properly exit that game once our animation is played back.

Contents