Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The Matrix object is an often misunderstood part of the MoGraph module. It's an object that looks for all intents like a cloner, but it doesn't actually make clones, it makes position information. Now that may seem kind of confusing, but we're going to use a very concrete example to show what that means. We're going to use the Matrix object to make a very simple train animation, combining it with Spline Wrap. Now in order to get started with this, let's take a look at what the Matrix object does. And I'm going to add a Matrix object to the scene, so let's go under the MoGraph menu and go to Matrix.
When I add that, I get this little grid of cubes in the scene, and these cubes represent position. If I hit Cmd+R or Ctrl+R on the keyboard, you see that my train part renders, but the little cubes did not. That's because they are just position information. I'll hit A on the keyboard to redraw the screen. So how do we use the Matrix object? Well, we use the Matrix object by cloning other things onto it. And so, I need to have a cloner for my train cars in order to clone them onto the Matrix object.
Let's go to the MoGraph menu, and go to Cloner, and then drag the Cloner down above the train cars. Let's take the train cars and make them children of the Cloner object. And when I do that, it's going to go to Linear Mode by default. And let's change that from Linear Mode to Object. And when I do that, they disappear. That's because the Object Mode is waiting for me to tell it where to put the clones. And so, we're going to say put the clones on the Matrix object. And when I do that, I get all these clones. Now the Matrix object was much smaller than the cars so the cars are all bunched together.
So let's go into the Matrix object and with it selected, use the Move tool and just drag out the handles for that to make the Matrix object larger. And you'll see that the Matrix object is in fact driving the position of all of those clones. And that's really the interesting thing about the Matrix is that it just makes position. Now how is this useful? This can be useful in the case of a train. I want to make a train that's going to go down a track. The easiest way to do that is with Spline Wrap, but unfortunately, when I use Spline Wrap, Spline Wrap is going to deform the train as it goes down the track.
I don't want the train to move like a snake. I want it to move like actual train cars, like as if they were solid objects moving down the track. So what I'll do is I'll use the Spline Wrap to wrap the Matrix object and then clone our cars onto that Matrix. So let's start off by preparing the Matrix object for the train. And what we want to do is under the Matrix, instead of using a Grid Array, let's set it to be Linear. Now it's going to switch around a bit. Let's change the X value to be minus, and we'll just scrub until we get a good distribution of our cars. And I think that's pretty good right there.
And we can only see three of our cars but we have four here, so we need to increase the count from 3 to 4 and we'll see the last of our cars. Now the order of the clones under here is very important. If I were to put the engine down here, you'll see that that's going to flip the order around, and that's problematic. So I'll bring that engine back up to the top. And you can see that it's first in line here. Now what we need to do is to build our Spline Wrap hierarchy. So let's start off with a spline, and let's click on the top view, and our spline needs to be quite a bit larger than our train, so I'm going to go into the B-Spline tool, and let's draw out a spline.
The exact shape isn't really important. I want to be careful with how small the curves are, and I'm going to go into the Selection tool and grab just that point and just move it and it kind of flatten this curve out a little bit. Just like on a real train, a real train can't go through a curve that has too small a radius. We want to do the same thing here. So that's pretty good, I think, for our train path. So now we can go back to the Perspective View, and we're going to use the Spline Wrap. And so, the Spline Wrap is a Deformer object, and I'm going to use it in Peer Mode.
So let's add a Spline Wrap to the scene, let's also add a Null. Let's call this Null Train Wrap group. Take the Spline Wrap and the Matrix object underneath it. Now the Matrix object needs to be placed under a Null, otherwise this is not going to work. So I'll select the Matrix object and hit Opt+G or Alt+G on the keyboard. And that places the Matrix underneath its own Null. And this is one of those things you just have to trust me on. It won't work correctly unless you do this, so let's go to Null and change the name and call it Train matrix.
Now what we can do is, under the Spline Wrap, the Spline Wrap needs to know what Spline should I use, and it's always a good idea to have the Spline above the hierarchy for the Spline Wrap. Let's twirl that down. And then in the Spline Wrap, we're going to tell the Spline Wrap to use this Spline to wrap that. Now when we do that, it looks like nothing's happened. Let's hit A on the keyboard. You'll see that our cars are all spread out. There's a little bit of strange lag here that I'm getting because of my recording software. You shouldn't get this lag at home, but if you do, hitting A on the keyboard usually forces the screen to redraw correctly.
Sometimes you can also drag the time slider left or right to get the screen to redraw correctly. Now what's happened here is that the mode for the Spline Wrap is Fit Spline, so it's taken my matrix and spread it out all across the Spline. You can see there's the other car down there. So I'm going to tell it to, instead of Fit Spline, to Keep Length. And when I do that, I'll move the time slider and you can see that it jumps everything down again. There's our train at the right end of the spline but, hey, it's upside down. The way we fix that is by using something called a Rail Spline. So let's make a copy of this spline by holding down the Control key, and let's call it Train Rail.
Let's call this other spline Train spline. And now, in the Spline Wrap object, underneath the Object properties, we'll go to the Spline field, and we're going to go to the Rail field and drag in the Train Rail. And when I do that, I'll drag right on the keyboard, and you see nothing happened. That's because the train rail is in exactly the same position as the original splines. So what I need to do is to go into the rail, and in Point Mode, select a single point, hit Cmd+A or Ctrl+A, and then drag all these points up. And now when I move the time slider, you see that the train will jump up to the right position.
Now I'm ready to animate my train. So if I go into the Spline Wrap at time zero, I'm going to set a keyframe for the offset parameters. So let's hold down the Control key and click on that gray dot and make it a red dot, and that sets a keyframe. And now let's move forward in time to frame 90, and then change that to be 100%, and I'll Ctrl-click on that. It looks like nothing happened and that's because of that screen redraw issue. Let's go ahead and hit Play, and you'll see that our train now animates along the path.
And it's a pretty convincing motion, if we scrub backwards in time, you'll see that as it hits its mark and goes through, the train is not deforming, it's actually moving along the spline and the cars are changing direction, they're following each other as they move down the Spline. And that's really the power of the Matrix. The Matrix object just generates the position information so we're not deforming the cars, we're actually deforming the Matrix and then cloning the cars onto that Matrix. And it clones them into the locations of their access points so that the cars don't get deformed.
That's one of the many uses for the Matrix object. Now that you understand the basis of how it works, experiment to see what else you can do.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 32801 Viewers
94 Video lessons · 22723 Viewers
78 Video lessons · 8959 Viewers
83 Video lessons · 8277 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.