From the course: Maya: Tips, Tricks & Techniques

Model a vehicle impact using nCloth - Maya Tutorial

From the course: Maya: Tips, Tricks & Techniques

Start my 1-month free trial

Model a vehicle impact using nCloth

- [George] Hi, I'm George Maestri, and today, we're going to crash a car. We're going to use Maya nCloth to simulate the deformation of the metal of the body of this car, when it runs into a pole. So, let's go ahead and get started. Now, the first thing we need is something for this car to collide into, so I'm going to draw a simple cylinder. I'm going to use that as the object, so I'm going to go ahead and create a polygonal cylinder, somewhere around there, and just drag this up, so that it's taller than the front of the car, and now we need to do just a little bit of animation, so I'm going to go ahead and just set a key frame here, and then about four or five frames later, I'm going to go ahead and just move this, so that it overlaps the front of the car. Now, I don't want to put it way into the car. This is just going to be a slight fender bender, so, something like, about, that, and set another key. So now, this is kind of hitting the front of that car. So now we have to figure out how to deform this car, and we're going to do that by using nCloth, so I'm really only going to deform this portion of the car, which is basically the main body, so I want to make sure that I hide the rest, so we can, basically, simplify the scene and just see what's going on. So I'm just going to select the entire car, and then Shift deselect the body of the car, and then just do Display, Hide, Hide Selection, or Control H, so now we've got this pole hitting the car body, and that's all that we have in the scene. So, let's go ahead and set up the body. Now the body, itself, is going to deform, and we're going to use nCloth to do that, so I want to make sure I'm in my FX Menu set, and then under nCloth, we can do Create nCloth. Now, when we do that, if we were to press Play, you can see that this car is starting to fall, as well as deform, so, by default, cloth has gravity turned on, so I'm going to select my car, go into the Attribute editor, find my nCloth shape, and actually scroll over one more to Nucleus. We're going to turn Gravity down to zero. So if I press Play now, you can see that we're not getting any falling of the car. Now go into nCloth Shape, and let's go ahead and set this up as a Sheet Metal object. So I'm going to go into Presets, softSheetMetal, Replace, and remember, we have the car's body selected, and so what this does is it just replaces all of the nCloth values with that of sheet metal. Now, when we played this before, the pole really didn't deform this, and that's because we haven't set that up as a collider, so the next thing we need to do is make sure that we select the cylinder, or the pole, and do nCloth, Create Passive Collider. And when we do that, it connects it into the system, and now it will impact the car. Now, if I want, I can make sure that my playback speed is at something like Play every frame, and when I do that, I can just playback and see my results, but I actually want to get a record of this. I want to cache it, so instead of just doing a playback, which will take some time, I'm just going to go ahead and jump straight over to nCache. So, I'm going to go nCache, Create New Cache, nObject, and I want to make sure I have this object selected. nCache, Create New Cache, nObject, and then select Go, and then if you've done it before, it may you give you this little warning, so I'm just going to go ahead and select Replace Existing, and now, the system will step through the scene and cache out the actual collision of the object with the car, so as you can see, we're stepping through, so I'm going to let this run, and we'll come back. So now I've gone ahead and gotten my cache. I've let it run through for 24 frames, and if we play it, you'll see this is what we get. Now, as you can see, the car bounces back from the force of the impact, and we get a very nice ... Or not so nice, if you own the car, crash, along the front of the car. So what I want to do now is, actually, take this crashed object and turn it into a blend shape, so that way we can control the crash, if we want. So, right now, this car body is moving back, and if we were to Show Last Hidden, which is all the parts of the car, you'll see that what it's doing is it's pushing that part of the car off of the chassis of the car, and so we'll want a little bit more control over that. So, I'm going to go ahead and select this body, and then I'm going to snapshot it, so I'm going to go back here, to, say, Frame 24, and then hit Control D, and what that does, is it creates a copy of that body of the car, so now I have two bodies. I have my body main, so then I have Body_Main1, rename that Body_Main_Crash, and so this shape can then be used as a blend shape for this, so the first thing I need to do is get rid of my nCloth, so I'm going to select my body, and then under nCloth, I'm going to say Remove nCloth, and I want to make sure I'm on Frame one, and when I do, it gets rid of it, and then I need to take this body and use it as a blend shape. Now, before I do that, I want to make sure that I move it so that it's over the body. I can't just do it by moving it this way. I need to move the vertices. Now, remember, when nCloth did its stuff, the pivot points stayed in the right place, and it just moved the vertices back, so I'm going to go ahead and select Vertex, select everything in that car, and let's go ahead and make sure that we're in World space, and I'm going to move it forward, something like that, then go back into Object mode. So now I have two versions of this car. I have the original version, and I have the crashed version, so I'm going to select the crashed version of this car, Main_Crash, Shift select the regular version, and then we're going to go into Rigging, Deform, Blend Shape. What that does is creates a simple blend shape for the original body. Remember, blend shapes work on the last object selected, so now I'm just going to go ahead and select the crashed version of the car and hide it, hit Control H, or do Display, Hide, and now, I have a blend shape, here, that crashes the car, according to that, so now, I can move this pole in, so somewhere around Frame three, under the blend shape, I can set a key, and then by Frame five or six, that will be at one, and set another key, so now, I have this car crashed, and if I want to, I could also crash it over multiple blend shapes, so if I wanted to, I could actually snapshot multiple blend shapes and then step through them, but hopefully, you understand the basic process, so what we did was we set up the car as a sheet metal cloth, we ran a passive collider into it, and we used that to create the deformation.

Contents