navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

Creating Simulations in Maya Dynamics

Creating Simulations in Maya Dynamics

with Aaron F. Ross

 


The dynamic simulation tools in Maya allow animators and visual effects artists to create convincing animations that would be too difficult or time consuming to keyframe by hand. This course covers the basics of the classic dynamics engine, showing how to build a simulation with passive and active rigid bodies, add attributes like bounce and friction, integrate the simulation with keyframes, and apply dynamic constraints. Author Aaron F. Ross shows how to apply these techniques to a realistic scenario, while explaining tools and concepts like the Rigid Body Solver, gravity fields, and dynamic constraints.
Topics include:
  • Choosing a scale convention
  • Laying out the scene
  • Modeling proxy objects
  • Creating passive and active rigid bodies
  • Imparting an initial velocity
  • Improving performance
  • Applying damping
  • Adjusting mass
  • Adding a Radial field
  • Keying the Active attribute
  • Baking the simulation to keyframes
  • Creating Hinge and Spring constraints

show more

author
Aaron F. Ross
subject
3D + Animation, Visual Effects
software
Maya 2013
level
Intermediate
duration
2h 11m
released
Nov 30, 2012

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:04Welcome to Creating Simulations in Maya Dynamics.
00:07My name is Aaron F. Ross, in this course we'll be looking specifically at Maya's
00:12Rigid Body Dynamic System.
00:14This is a physics engine built into Maya;
00:16it can save you a lot of time when animating collisions and other phenomena that
00:20would be too difficult or time- consuming to keyframe by hand.
00:24In this course, we'll cover the following topics:
00:27understanding the importance of scale, generating physically accurate
00:31simulations, working with gravity and other forces known as fields, adjusting
00:37physical properties such as friction and bounce, baking a simulation to
00:42editable keyframes, and applying constraints to connect and limit the behavior
00:47of dynamic objects.
00:49Let's take a look at what Maya Dynamics can do for us.
Collapse this transcript
Prerequisites
00:00Before we launch into Maya Dynamics, there are just a couple of prerequisites I
00:04need to mention in order to get you started.
00:07First of all, this is an intermediate level course, meaning that you're assumed
00:11to have some experience with Maya already.
00:14In other words, you should be able to navigate the program, build objects and animate them.
00:20Second of all, you should have a pretty fast computer.
00:23Dynamics Simulations can take quite a while to calculate and if you've got a slow
00:27computer it really is not going to be much fun to work with.
00:30Additionally, if you've got a multi- core or multiprocessor computer, that's a
00:35very good thing, because Maya is multithreaded and it can take advantage of
00:40multiple cores or multiple processors.
00:43Finally, you need to have a healthy dose of patience and perseverance.
00:48It's well known that Dynamics can be slow to calculate because they are
00:51calculation intensive.
00:53Also, sometimes simulations might not work the way you want them to and you'll
00:58need to do quite a bit of detective work to try to figure out what the problem
01:02is. However, once you've got some experience under your belt, you can usually get
01:06the results that you want, and it will almost always be faster to do that than
01:11to animate an entire scene by hand.
01:14And those are just some of the prerequisites before we begin our journey
01:17into Maya Dynamics.
Collapse this transcript
Using the exercise files
00:00We're almost ready to start working with Maya Dynamics.
00:03I just want to mention at the top that I have slightly hot-rodded the Maya interface.
00:08Not a lot; you'll certainly be able to find your way around.
00:11The main difference you'll see is that I'm using black text on a white
00:15background, and the default interface of Maya is currently white text on a black background.
00:22And to me, that's more difficult to read and it just slows me down. Therefore,
00:26I'm using the old-school black text.
00:29Now I'm not going to cover how to set up Maya for that interface in this
00:34training course, however I did cover it in a previous training course which is Maya 2011:
00:40Creating Natural Environments.
00:42And in fact there are two movies Setting Up the Exercise Files and Setting Up the Mac.
00:48The other thing I want to mention is that if you are a Premium subscriber to
00:52lynda.com then you can download the Exercise Files for the course and once
00:57you've done that you'll need to point Maya at that project folder, and that's a simple process.
01:03Of course, we can go to the File menu and choose Set Project.
01:07And I've got the Exercise Files here on my Desktop so all I need to do is just
01:11select that and click Set.
01:13Then when I go to Open a Scene it will take me directly to that
01:18Exercise_Files>Scenes folder and these are all the Maya ASCII scene files for the course.
01:24If you're not a premium subscriber to lynda.com and you don't have the
01:28Exercise Files, then I recommend that you create a project folder for the
01:33course, that way you can put all the assets in that one project folder.
Collapse this transcript
1. Building a Simulation
Understanding the rigid body solver
00:00Let's take a moment just to understand the basic concepts of Maya's Rigid
00:05Body Simulation System.
00:08It's a physics-based simulation that's designed to animate objects that are near
00:14the scale of the human body.
00:17It wouldn't work well for things that are the size of an atom or the size of a planet.
00:22It's very useful for calculating collisions and other physics-based simulations
00:27that would be too difficult to animate by hand.
00:30And when they say, "rigid body," they mean that quite literally. This type of
00:34simulation only works with objects that don't change shape over the course of the animation.
00:41So in other words, no deforming surfaces are allowed: only objects that
00:46don't change shape.
00:47You can use polygons or NURBS to build your R0igid Body Objects, but you will
00:52need to keep the level of detail down very low-- in fact, much lower than you're used to.
00:59Because in fact this Rigid Body Simulation System within Maya dates back
01:03actually to the very earliest days of Maya, and because of that, it has some limitations.
01:10We will have to work around those limitations as we go forward, and to actually
01:14build and construct our scenes so that we don't overload our system and that
01:19we'll actually be able to see a dynamic playback in our viewports in real time.
01:25Again, the polygon count or vertex count in the case of NURBS will need to be
01:29kept very, very low.
01:32As always your mileage may vary.
01:34Attribute values may be different.
01:36In other words, I may put in the value of 100 but on your system with your
01:41version of Maya and your scene-- even if it's the same scene-- you may actually
01:46have to use different attribute values to get a similar result.
01:50But I'm here to show you the ropes to lead you through all those difficulties so
01:55that hopefully you will have some good results with your dynamic simulations
02:00using the Maya Rigid Body Solver.
Collapse this transcript
Setting animation preferences
00:00When working with Dynamics in Maya, you have got to set up your preferences just
00:04in a certain way so that your simulation will play back properly.
00:08We need to get that sorted out before we even begin to think about building
00:12anything or making it move.
00:13I am going to go ahead and play my simulation here and it seems to be playing
00:18okay and it seems to be a bit slow, but it is playing and it's fine, but I'm
00:24just going to take the precaution of setting my preferences, so that there will
00:27be no unexpected negative results later down the road.
00:30I'm going to go into the Window menu to Settings/Preferences>Preferences and go
00:36into the Time Slider section and you'll see here in the Playback section, we
00:41needed to just tweak these settings a little bit.
00:44I like to view the animation in all the viewports, not just the Active view, so
00:49I'm going to activate Update View in All.
00:51But more importantly down here, we've got our Playback Speed, and the default is
00:57to play every frame with no limit on the maximum speed.
01:01What we need for Dynamics is a slightly different variation on this.
01:06We do want the Playback Speed to be "Play Every Frame", but we don't want to
01:12exceed the current time base-- which is actually 24 frames a second currently.
01:18In a lightweight scene, your simulation may actually run faster than normal
01:24unless you activate Max Playback Speed>Real-time.
01:29Playback Speed>Play Every Frame means that literally Maya will not skip frames
01:33when it's doing the simulation.
01:35It will play frame 1, 2, 3, 4, 5 and it won't skip frames in order to keep the
01:42overall frame rate of 24 frames a second.
01:45This is very important because Maya's Dynamics are so-called "history dependent."
01:51What that means is that what happened on any given frame is directly dependent
01:56on what happened exactly one frame before that.
02:01In other words, on frame 10, I need to have information for what happened on frame 9.
02:07And if we skipped frames then that information is lost.
02:11We can never skip frames in a simulation.
02:14The simulation will just simply break if we allow that to happen.
02:18The Playback Speed must be at Play Every Frame to make sure that we don't skip any frames.
02:23Additionally, we don't want to exceed the time base of-- in this case-- 24 frames a second.
02:29Click Save.
02:31By the way, there is a faster way to change the Playback Rate.
02:35You can just simply right click on your Timeline and choose Playback Speed, here
02:40we go, Play Every Frame, Max Real-time, and that's the setting that you always
02:45need to have when working with Dynamics, 100 percent of the time.
02:50Finally, I also want to enable the Frame Rate in my viewports and I need to do
02:55that so I'll know if it's playing back too fast or too slow.
02:59I'll simply go up into the Display menu and choose Heads Up Display>Frame Rate.
03:05And once that's on, I'll see in the lower right-hand corner of each window a
03:09frames per second readout.
03:12I'm currently getting about seven or eight frames a second.
03:17This Frame Rate readout here is actually only reliable in a full screen window.
03:23So I'll hover my mouse over here and tap the Spacebar and make that window bigger.
03:28And now I'm pretty sure that this is the actual Frame Rate I'm getting.
03:34It does vary depending upon how close the objects are to one another.
03:39So we've set our Preferences, I'm just going to go ahead and choose File>Save
03:43Preferences, to make sure that that's stored for the next exercise.
Collapse this transcript
Choosing a scale convention
00:00Before we even begin to think about building a Dynamic Simulation, we have to
00:06adopt a scale convention.
00:08That's universal for all Dynamics, not just Rigid Body Dynamics.
00:12Before we animate it, before we even build models, we need to think about how
00:16big they need to be.
00:18If your objects are built at the correct scale, then your Dynamic Simulation
00:22will run accurately.
00:25If they're built to a different scale, you'll get a wildly different result.
00:29You need to make sure you do this properly in order to get good results in your simulation.
00:34Of course, you can tweak it after you've made it physically accurate.
00:39That's a good workflow to follow.
00:41To make things physically accurate-- how do we do that in the first-place?
00:45We have to build our scene to a scale convention and I've got three examples here.
00:50I have got my bowling pins at 1:1 scale such that each bowling pin is about
00:5640 centimeters tall.
00:57That's a 1:1 scale model.
00:59Then I've got a 1:10 scale model where each bowling pin is an order of magnitude
01:05smaller, about 4 centimeters in height. And right here at the origin, I've got an
01:11itty-bitty teeny tiny set of bowling pins where each one is only about 0.4
01:17centimeters in height and these are built at a scale of 1:100th.
01:22So why would we need this?
01:24Why wouldn't we just go ahead and build everything at 1:1 scale?
01:27That seems like an obvious thing to do.
01:30In a lot of programs that is exactly what you would do, but Maya is not that
01:34program, at least not always.
01:36Maya wants to actually make you build your scenes to 1:100th scale.
01:43Scale in Maya is not straightforward and it doesn't make a lot of sense
01:47compared to some other programs, but I am going to show you how it works and we
01:52will figure it out.
01:53I am going to go into the Window menu and go into
01:56Settings/Preferences>Preferences, and go directly to the Settings section and
02:03you'll see the Working Units.
02:05Working Units is currently set to Centimeters and that is the default.
02:09With the default grid settings, what I will see here is I've got a grid
02:13that's 12 centimeters from center to edge and I've got subdivisions every one centimeter here.
02:19Well, this is actually kind of weird, because the Dynamics engine thinks by
02:26default that each one of these grid units is a meter, not a centimeter.
02:32So you've chosen Centimeters as your Working Units, but the Dynamics engine
02:39always assumes that your world is built to 1:100 scale.
02:45If I change this to some other setting like Inch or Foot, that doesn't change
02:51the size of objects in the scene.
02:53I am just going to put it back to Centimeter and click Save.
02:57What matters is not what you've chosen in that Preference dialog, but what
03:02matters in fact is what is the absolute size of the objects.
03:07So if you choose centimeters as your units of measurement, that's an easy-breezy
03:12solution; you just build your objects at 1:1 scale.
03:16However, if you do it at 1:1 scale as I've done here, then we'll have to take
03:20some extra steps, for example the gravity won't be strong enough.
03:24However, if you build your scene at 1: 100th scale, if you make an itty-bitty
03:29teeny-tiny version of your scene, then Maya will correctly calculate the physics
03:36simulation for that.
03:37I am going to be building my scenes at 1:1 scale, but going forward in your
03:42own scenes, you can adopt that convention of 1:1 and then you will need to
03:47increase the strength of gravity or you could build your scenes at 1:100th scale
03:52and the workflow for that is leave the Working Units as centimeters, but
03:58literally just pretend in your mind that they're meters, because that's what
04:02the Dynamics engine is doing.
04:04That seems really counterintuitive, and it is.
04:07But that's how you have to do it, if you want to build it 1:100th scale, but the
04:12main thing is you need to adopt a convention in advance and you need to know
04:16what that convention is, and the standard ones are 1:100th, 1:10th, and 1:1.
Collapse this transcript
Laying out the scene
00:00Let's take a quick look at laying out a scene for a Dynamic Simulation.
00:05In the vast majority of scenes most of the geometry does not participate in the simulation.
00:11Only things that are actually going to be touching each other and colliding are
00:15going to need to be dynamic and everything else you probably just want to put
00:18that on the layer and reference it to make it untouchable.
00:22That's what I will do.
00:23I am going to open up the Window>Outliner and you'll see down here I've got some groups.
00:29I've got the alleyGroup which is the one lane that's going to be dynamic and
00:34then I've got a bunch of other groups here.
00:36I have selected all those just by dragging my mouse across them and in the
00:40Channel Box, in the Layer Editor here, I am going to click the button to create
00:45a new layer and add the selected objects. And there it is.
00:48They are in Layer 1 and I can toggle that visibility on and off.
00:51I will double-click that layer and rename it roomLayer, and click Save.
00:58I just want to add all the other non-dynamic geometry as well.
01:01I've got a box for the room.
01:03I'll hold down Ctrl+Shift and I will select some of these other elements here
01:07that are important for rendering, but not for the Dynamics, and then right-click
01:12on my roomLayer and add the selected objects.
01:14I can toggle that on and off.
01:16You will see I've done that for the lights as well.
01:19I will just click here in this box a couple of times until I see the letter R,
01:25meaning that, that layer is currently referenced and I can't accidentally select
01:29it or do anything to it.
01:31I just want to make sure that I've placed all the non-dynamic objects onto a
01:37layer so that I can quickly reference or hide them in order to focus on what's
01:42important in this case, which are of course, the dynamic objects.
Collapse this transcript
Modeling proxy objects
00:00We are still in a bit of preparation mode, getting our scene ready in order to
00:04apply Rigid Body Dynamics.
00:06As I mentioned it in an earlier movie, there are some limitations to the polygon
00:10count for Maya's Rigid Bodies.
00:13You can't just create an object of any arbitrary level of detail and expect that
00:17to calculate as a Dynamic Simulation.
00:21In fact, even just moderate levels of detail are going to completely overwhelm
00:25the Rigid Body Solver.
00:28In order to get good results, what you often need to do is model so-called "proxy objects."
00:34A proxy object is a very low level of detail object and that proxy object will
00:39be the one that has the Dynamics applied to it and there will additionally be a
00:44high level of detail object which will be renderable and the renderable
00:48object can be constrained to the proxy.
00:51That way you get the best of both worlds.
00:53The proxy object calculates the Dynamics.
00:55It's very simple and it's fast.
00:58The high level of detail object looks good.
01:01For any Dynamic Simulation, you're going to have to think about this.
01:05You may need to build multiple versions of your object.
01:09So I am just going to run through the process of very quickly making a bowling
01:13pin using Revolve.
01:14If you have never used Revolve before, it's not hard, it's quite simple.
01:19I want to go into my side view here and just display the grid.
01:24The shortcut to turn that Panel toolbar on and off is Ctrl+Shift+M. So here in my
01:31side view, I want to get ready to make a bowling pin.
01:35So I will tap the Spacebar and zoom out a little bit with the Wheel and I know
01:40that it's going to be about 40 centimeters tall.
01:42Well, it's hard for me to count those directly.
01:46I would just want to go into the Grid Options, Display>Grid Options and I am
01:51going to set my Length and Width here to 100 centimeters, a Grid line every 10
01:58centimeters, and then subdivide it by 10, and additionally, I want to choose a
02:04different color for the Grid lines and Subdivision lines.
02:08With these settings, basically, I'll get a major Grid line every 10 centimeters
02:13and a minor Grid line or a Subdivision line every 10 divided by 10 or every 1
02:19centimeter and if you scroll down a little bit too, you can also turn on numbers
02:23on the axes if that helps you visualize.
02:25Now I click Apply and click Close.
02:28Now I can see very clearly, okay, this is 0 centimeters, 10 centimeters, 20, and so on.
02:34I want to make a Revolve and to do that I'll use a NURBS curve.
02:39I also want to Snap to Grid while I am at it.
02:42I will turn on Snap to Grid up here and I will go to Create menu and choose the CV Curve Tool.
02:49And for a Revolve, it's really important that the first point and the last point
02:53have to be exactly on that center axis as seen in the side view.
02:58So I am going to click a couple of times on the origin here to make two points there.
03:04You want to do that really slowly;
03:06don't go too fast, you want to click super slow, once and twice.
03:11If you click too fast, then Maya is just going to interpret that as a
03:15double-click, but if you do two slow clicks, then it'll interpret that as two points.
03:20All right!
03:20So I am going up here and up at the top once again I am going to click once and
03:25then wait a heartbeat and then click a second time.
03:29Once I've drawn that curve, I'll press Enter.
03:32To change the shape of the curve, I'll right-click and go into Control Vertex
03:36mode and move those points around with the Move tool.
03:40Now that I've actually got it blocked out, I can turn the Snapping off.
03:45Depending upon what object you are building, of course, you will need different
03:48methods to build it.
03:50The Revolve is obviously the best choice for a bowling pin, because it's
03:54really symmetrical.
03:57So there's my curve.
03:57I will go ahead and go back to Object Mode, select that curve, and I want to make a Revolve.
04:05To do that, I'll go to the menu set and choose Surfaces and then in the
04:11Surfaces menu I want to choose Revolve, but I'll go into the Options.
04:16I want to make polygon objects here so that I can really precisely control the
04:21level of detail and in the Revolve Options-- just make that a little bit bigger
04:27here-- I want to output to Polygons.
04:30So here is Output Geometry, so I will choose Polygons.
04:34Additionally, I want to do Quadrilaterals, that's just going to be more efficient.
04:38And I can play around with some of this stuff later, but I think for now I'm
04:43just going to choose General and I will click Revolve.
04:46Now I don't have much here.
04:47It actually is a Revolved object, but I will just need to go into the
04:52nurbsTessellation settings.
04:53I will tap the Spacebar so I can go back out to my Perspective view and just
04:58dolly back a little bit.
04:59With that object selected, I'll hit Ctrl+A to get the Attribute Editor and I
05:04want to find the nurbsTessellate node.
05:06Here we go, nurbsTessellate1.
05:09I just want to go into the Advanced Tessellation Options and play around with them.
05:14General Tessellation, I just want to increase the numbers here.
05:19Now of course, this is still live.
05:21In other words, if I change the shape of my curve, I'll change the shape of this
05:25bowling pin for the Revolve surface.
05:29So those are not quite the right proportions, but that's okay, because I can
05:32just get in a little bit closer on that curve, select it, and then right-click,
05:36and choose Control Vertex once again.
05:38It's important that I am manipulating the control vertices on the curve and not
05:44the points on the Revolve.
05:46It's also very important that I cannot make this curve overlap itself.
05:51So that's not the world's greatest bowling pin, but that gives you an idea of the process.
05:56So that would be my high level of detail.
05:59I know you will look at that and you will think, well, that's not really very
06:01high level of detail.
06:02That looked kind of blocky by my standards, but it's sufficient for rendering.
06:07Now I will go back and I will make another one.
06:10I want to be in Object Mode to do that.
06:12So I will right-click on that curve and choose Object Mode and select the curve
06:16and I will make another Revolve, but just use lower settings for that one.
06:20Surfaces>Revolve, go back to the Options.
06:23In fact, I will leave all of this the same, click Revolve and then the second
06:27one that's been built here revolveSurface2.
06:30I will go to its Attributes, Ctrl+A, and increase this number up, but I just
06:35need it to be a lot blockier than the full level of detail version.
06:39So you can see that I've got two of them now.
06:42I've got one that's really blocky, and I got one that's somewhat smooth.
06:49That's the basic principle.
06:50I need to have two versions of my model; the blocky one here is going to be the
06:55one that's going to have the Dynamics applied to it, and the nice pretty one is
07:00the one that we will actually render-- Ctrl+Z to undo that.
07:04Once you've got your levels of detail made, then the next step is to connect them.
07:09You can either parent them or even better, as I'll show you in the next movie,
07:13we will use a parent constraint.
Collapse this transcript
Constraining renderable objects to proxies
00:00Let's look at organizing our proxy objects.
00:03Once again, we want the low level of detail to be dynamic and the high level of
00:07detail to be renderable.
00:09I need two versions of each object to do that.
00:12And I can either parent them or constrain them.
00:15Let's look at parenting first.
00:16I'll open up Window>Outliner and scroll down a bit so you can see what I have
00:22done, I have got pin_low_res_1, pin_hi _res_1, 2 and 2 and so on and in fact
00:30the difference between these is even more dramatic than in the demonstration I
00:34gave in the last movie.
00:35If I just move this guy over to the side, you can see that it's really quite
00:39blocky and the high LOD is considerably smoother.
00:43Now I'll Ctrl+Z to undo that, put those back over one another.
00:48One way I could do this once again is just to simply parent them.
00:51I'll select the high LOD and then Ctrl+ select the low LOD and hit the P key or
00:59else just choose Edit>Parent and now the low level of detail pin is the parent
01:06and the high LOD is the child, so if I select the low one and move it of course
01:11the high LOD will move with it, Ctrl+Z to undo that.
01:15That seems pretty simple, but there's a problem with this, when I go to Render,
01:20--go ahead and click Render-- and this is going to render in Maya hardware, so it
01:23can render really quickly, you can see that low level of detail object there; I
01:27really don't want that.
01:29We could go into the Shape Properties for each one of these low LODs and make
01:33them non-renderable.
01:36I'll hit Ctrl+A to open up the Attribute Editor and what you're looking for is
01:40the Shape node and the Render Stats section.
01:43You'll need to open that up and you'll need to turn all this stuff off.
01:47We don't want Shadows, you don't want it to be Visible in Reflections or
01:51Refractions and most importantly you want to turn off its Primary Visibility.
01:57With all those switches turned off, then that low LOD model will never render.
02:01I'll go ahead and do another test render and you can see it's as if it
02:05wasn't there at all.
02:06Well, that's kind of tedious because you'll have to do that for each object.
02:10I am going to undo what I've done, I'm going put all these back on again and I
02:15am going to unparent this, so I'll select that, I'll say Edit>Unparent or just
02:21Shift+P and now I am back where I was, I have got low_res_1 and hi_res_1, just
02:28move that back up there with a middle mouse.
02:31So instead of parenting, I can use Constraints and that's actually better and
02:37the reason is that if I use a constraint, then I can easily toggle the
02:41visibility for all of the low LODs and all the high LODs independently.
02:48In other words in my viewport, I can choose to see just only one of those or both.
02:52To make a constraint, I want to be in the Animation menu set and I want to
02:57select the thing that's going to be the constrainer or the sort of leader
03:02first and I want to select the thing that is going to be constrained or the
03:07follower second, which is the opposite of what you would do for a parent-child relationship.
03:13Again, I want to select the leader first and that's going to be the low LOD and
03:18then I'll Ctrl+select the follower which is the high LOD and I go up to the
03:24Constrain menu and choose Parent Constraint.
03:27Now you might want to go into the options just to be sure and reset them.
03:32We just want to make sure we're constraining in all axes and click Add and
03:38that's that. It's done.
03:39If I select the low-res pin now, I can move it and the high-res pin is moving with it.
03:45You don't see a parent-child relationship here, but if you open up the high-res
03:50object you'll see there's a constraint node inside there, so that's the
03:54indicated, there's a constrained-in effect.
03:56If I need to remove that, of course I can just select it and press the
04:00Delete key on my keyboard.
04:01So I could go through that process and do that for all these.
04:05Select the leader, then the follower and I can actually just press the G key on
04:10my keyboard and that will perform the most recent command again. Done. I'll just
04:16go down the line, use the Ctrl key, select, press G.
04:23So I think I'm all right here.
04:24I should probably test my work and make sure.
04:27I'll select the low LOD of each one and make sure that the high LOD is
04:31actually following along.
04:33It takes extra time to do so, but that time will be saved in all the mistakes
04:38that you're not going to make, because you've tested it.
04:42Now we're ready in our next movie to actually put these on different
04:46display layers.
Collapse this transcript
Organizing display layers
00:00We're almost ready to actually create our Dynamic Simulation;
00:04we just have a little bit more setup to do.
00:06I know that this is kind of tedious to have to go through all that, but if you
00:10don't create proxy objects you simply won't be able to meaningfully create any
00:15kind of good looking simulation.
00:17So I have created the constraints. All I need to do now is just place them onto
00:23display layers so that I can toggle their visibility.
00:25I'll go back into my Window>Outliner and I'll select all the low res pins
00:30those are going to be the dynamic pins and I go into my Display editor here
00:35and click on the button to create a new layer containing the selected objects
00:40and it's called Layer 1. I'll double-click on Layer 1 and I'll call that one dynamicsLayer.
00:48Because we've used constraints here instead of a direct parent-child link, we
00:53can toggle the visibility of all those objects without affecting the high LOD objects.
01:00If it were a direct link then when I click here to hide those low LOD
01:06objects, the high LOD objects would inherit that visibility, because they would be children.
01:12So again, we're not using a parent- child relationship, we're using constraint,
01:15so that we have the freedom to toggle the visibility of those two sets of pins
01:20independently of one another.
01:22I'll select these high LOD pins and put those on a layer as well, I'll make
01:27a new layer, Layer 1 once again, double-click that and I'll call that one
01:32pins_highLOD_Layer.
01:38Now I have the ability to turn these on or off at will and of course when I
01:43render I want to have these visible and when I'm animating I may want to have
01:48those hidden and only see the dynamic objects.
01:51Very good. We've got our scene set up and we're ready to create some Dynamics.
Collapse this transcript
Creating passive rigid bodies
00:00Now we are ready to start simulating.
00:03We want to create so-called "passive rigid bodies" for the ground plane and
00:08any collision objects.
00:10A passive rigid body is one that will collide with other rigid bodies, but it is immobile.
00:18It will stay static.
00:19It could actually have keyframes placed on it unlike an active rigid body which
00:24is going to be directly under the control of the simulation.
00:28In general, the passive rigid bodies will be things like the ground plane or in
00:32this case the backplane of my bowling alley lane.
00:36So, to create a passive rigid body, you simply select an object like this
00:40backplane here, and you want to go into a menu set up here called Dynamics.
00:45Not nDynamics, that's Nucleus Dynamics.
00:49What we want this time in fact are the old-school plain vanilla Dynamics.
00:56And with that object selected, I will simply go up here to the menu that says
01:00Soft/Rigid Bodies, and I want to choose Create Passive Rigid Body.
01:07Now two things have happened.
01:08Number one, a node has been added to that object: it's a Rigid Body node.
01:14Go over here to the Channel box and scroll down a little bit, and you'll see
01:18there it says Rigid Body1.
01:19And if I click on that to open it up, you'll see it has a bunch of properties,
01:23things like mass and friction and so on.
01:26So that Rigid Body node has been created for that one object.
01:30Additionally, a Master Rigid Body Solver node has been created.
01:35That's the global settings, basically the quality settings for the entire
01:40simulation and all the objects within it.
01:43If I scroll down a little bit further in the Channel box, you will see now at
01:47the bottom, there is a Rigid Solver node.
01:49And I can open that up just to show you that it's got some properties in here.
01:53We really won't need to change those properties;
01:56they're fine as they are.
01:57I just wanted you to see that that Rigid Solver exists.
02:00And once again, that's the master controller for all of the rigid body
02:05objects in the scene.
02:07We could actually have multiple Rigid Solver nodes per scene, but we don't need
02:12that in this case. We're fine with just having one.
02:15I just want to go around and create passive rigid bodies for the rest of the
02:19geometry that the pins might collide with.
02:22And that's these two backplanes here, hold down the Shift key to select some more,
02:28the gutter here and the gutter here, and of course the playing surface.
02:34So I've got everything selected that wants to be a passive rigid body, and I
02:39just go up to Soft/Rigid Bodies>Create Passive, done.
02:42You'll notice by the way that for any object that has a Rigid Body node
02:48attached, you'll see a little x at the center of the object, and that's
02:52it's center of mass.
02:53If I hit the 4 key on the keyboard so we can see wireframes, you can see that a
02:59little bit more clearly, there's a little x in the center of each one of these.
03:03We'll come back to that later when we talk about animating.
03:06But, for now, I just wanted you to know that, that's what that little x was.
03:10That's an indicator that there is a Rigid Body node attached to that object.
03:14Finally, if I select the object and look at its transforms, Translate and
03:18Rotate, you'll see, in this case, they are all in yellow.
03:22Ordinarily, that means that there's an incoming connection, and that is the case
03:26here. In fact, the Position and Rotation channels are going to be controlled by
03:31the simulation or by the Rigid Solver node.
03:34However currently, they've been made passive.
03:37So although these are showing up as if they're under the control of something
03:40else, they're actually not under the control of anything right now, and they
03:44could in fact be keyframed if needed.
03:46So, don't let that throw you off. Just because those are yellow there, doesn't
03:50mean that you can't move or animate a passive rigid body because you can.
03:56In the next movie, we'll create active rigid bodies which will actually move.
Collapse this transcript
Creating active rigid bodies
00:00Next, we'll create active rigid bodies.
00:03An active rigid body can actually move according to the laws of physics, whereas
00:07a passive body will remain static or could be keyframed.
00:11I will open up the Outliner once again, Window>Outliner, and I want to select
00:16all the low LOD pins, and I also want to select the bowling ball.
00:22It's just a plain old ordinary polygons sphere, nothing fancy about it.
00:26I can hold down Shift and select that.
00:28I'll just add the active rigid bodies all in one go.
00:32Go up here to Soft/Rigid Bodies and you will see Create Active Rigid Body.
00:38And in fact, it creates the exact same node as a passive rigid body.
00:42The only difference is one switch which is whether it's active or passive.
00:46I'm going to go ahead and add this, each one of these now has a Rigid Body
00:52node attached to it.
00:53So if I select the bowling ball, you'll see it's got Rigid Body17 attached to it.
00:58And they're all connected to the same Rigid Solver.
01:03Nothing much is going to happen just yet, they've been made active, but they
01:07won't move unless there's some force applied to them.
01:11We'll do that in the next movie.
Collapse this transcript
Adding a Gravity field
00:00A Dynamic Simulation won't do anything if there are no forces acting in the world.
00:05I have correctly set up my scenes, so that the collision objects have all been
00:09made passive and my low level of detail dynamic objects have all been made
00:15active but again, nothing will happen if there are no forces in the world.
00:20And I can apply forces in different ways. One is to use a Field.
00:25In Maya Language a Field is an object that affects dynamic objects.
00:32You can add gravity,
00:33you can add wind, or whatever you want in order to influence the behavior of
00:38the dynamic objects.
00:39The Maya Rigid Body Dynamics Solver does not have gravity by default.
00:44So we will need to add that.
00:46I can select one or more objects and add gravity.
00:49Let's just do the bowling ball first.
00:51I've got that selected. Maybe I will move it up a little bit so we can see
00:56the effect of gravity.
00:57With it selected, I'll go into my Dynamics menu set and Fields and you will see
01:02they are bunch of them there and these are really cool by the way, because the
01:06Fields will work with other types of Maya Dynamics as well; if you use nCloth or
01:12Fluids or nParticles-- all kinds of stuff-- the fields will affect all of them so
01:18it's not just for a Rigid Body Dynamics.
01:20So I am going to click on Gravity and I do get a Gravity field created and you
01:26can see it here in the Outliner and you can see that it's currently selected.
01:30It's placed at the Origin right now.
01:33And we go out to a top view, tap the Spacebar here and go to the Origin you can
01:39see there is my Gravity field.
01:40It looks like three little arrows pointed down.
01:43I could position that anywhere in the scene and it won't affect the gravity.
01:47I could even rotate it or scale it and it will make no difference.
01:50I am just going to place it up here close to the action, so that it will be nearby at hand.
01:56Now I'll maximize that view again with the Spacebar.
02:00I'll go ahead and press the Play button, but before I do, I want to double-check
02:04and make sure that I am playing at the right speed, remember this once again.
02:07I have got to check to make sure it's Play Every Frame Max Real-time.
02:11I will right-click and choose Playback Speed>Play Every Frame, Max Real-time.
02:18So my Timeline is set up.
02:19Now I have also got a Frame Rate down here-- remember I turn that on in the
02:24Display menu, Heads Up Display> Frame Rate-- so that needs to be on as well.
02:28Rewind and play back and you will see my ball starting to fall, but wow it sure
02:33is falling slowly and according to my Frame Rate readout it's saying that I'm
02:38playing back at about 24 frames a second.
02:41But with 60 frames in my timeline, the ball is still not reaching the ground
02:45even though it's falling for nearly 3 seconds.
02:48This is a scale issue.
02:50This is precisely what I was talking about in an earlier movie when we discussed scale.
02:55Maya is assuming that my world is built at 1:100th scale.
03:00So Maya is assuming that my bowling pins are 40 meters tall, even though I built
03:06them at 40 centimeters tall.
03:10If you have built your world at 1:100th then you're fine: you don't
03:13need to change anything.
03:14But if you've built it at any other scale then, you will need to change things
03:18like the strength of gravity and that's what I need to do here.
03:22I'll select that Gravity field and I want to find its attributes, so I will
03:27just go into the Channel box and I am looking for Magnitude, here it is.
03:31That's the strength of the gravity and you will see it says, 9.8.
03:35So if you remember from physics class if you ever took physics;
03:38the acceleration of an object in Earth's gravity is 9.8 meters per second per second.
03:44That means with every second, it's falling 9.8 meters and another 9.8 meters for
03:52each additional second.
03:53Faster, so it's accelerating as it falls.
03:57This is in meters 9.8 meters but that only makes sense if your world is built at 1:100th scales.
04:04Again if your world is built at 1:100th you're fine, but if it's built
04:08at 1:1 then the gravity is not strong enough.
04:13The Gravity is currently now one one -hundredth of what it needs to be.
04:17For scenes built at 1:1 scale the magnitude for physical accuracy should be 980.
04:24Now you will find that if it's at a 1000 or somewhere in the vicinity of that,
04:28it's going to look fine but that's the technically accurate value.
04:32So I will rewind and press Play and that's much better and my bowling ball is
04:36actually falling like a bowling ball, it's only taking less than one second to hit the ground.
04:42I also want to attach the gravity to my bowling pins.
04:45Because if I actually sent the ball down the alley right now, the pins would fly
04:51off and would not actually fall to the ground.
04:53So they need to have gravity attached to them as well, and there is
04:56multiple ways of doing that.
04:58But the easiest way is to simply select them and select the Gravity node and
05:02issue in menu command.
05:03I will go into my Outliner once again.
05:06I want to select all the low LODs.
05:09Those are the ones that have the Rigid Body nodes attached to them and I want to
05:13select my Gravity node as well, so I can Shift+Click on that and go up into the
05:18Filed menu and choose Affect Selected Object(s) and now the connection has been
05:25made so that all the bowling pins will also be under the effect of the same
05:29gravity field and if I get in really closely on that and play it, we might see
05:35them drop a little bit.
05:36Looks like I probably have to move them up in order to see that happen.
05:41Just that we can see the full effect, I will just move these up a bit and
05:47rewind and let them drop.
05:49You can see now that in fact gravity is affecting all those dynamic objects.
05:56You notice by the way that I have been rewinding every time and pressing Play.
06:01This is really important;
06:02you can't scrub in the Timeline for Dynamics because it's history dependent.
06:08What's happening on frame 30 depends upon what happened on frame 29 and if you
06:12are skipping around here, it's going to go haywire.
06:14This is a pretty simple simulation but if you've got a heavy scene with lots of
06:18stuff going on, what you'll find is if you try to scrub in the Timeline then,
06:23Maya will appear to freeze up as if it had crashed.
06:26In fact it's not crashed;
06:28it's just calculating all the frames up to where you currently are.
06:32The only things you are allowed to do are Rewind, Play, and step forward
06:38one frame at a time.
06:41I know that seems really limiting. That's reality.
06:44So we've got a gravity field in our scene and next, we want to just play around
06:49with center of mass.
Collapse this transcript
Moving the center of mass
00:00Let's look at center of mass.
00:02Center of mass is kind of like a pivot point, in as much as it's the point
00:08around which Transforms are calculated.
00:10For ordinary animation hierarchy, the pivot point is the location around which
00:15that object will move, rotate, and scale.
00:18For dynamic objects, the center of mass serves the same function.
00:22It's basically the balance point around which an object will revolve and move.
00:28I haven't changed the center of mass for any of the objects in my
00:32simulation just yet.
00:35So I'll get in a little closer on one of these low-res pins here and if I hit
00:40the 4 key, I can look at the wireframe and you can see that little x in there,
00:45that's the center of mass.
00:47And it's located by default sort of at the average of all of the vertices on the object.
00:55Sort of like if you would use Center Pivot command, it would move your pivot to
00:59that average location of all the vertices.
01:02And with the default location for the center of mass, my objects will behave
01:07more or less accurately.
01:09If I for example rotate my bowling pin, so that's off kilter a little bit, hit
01:15the 5 key, so we can see that little bit better and press Play, you will see
01:20that it tumbles and falls and bounces in a more or less realistic way.
01:24What does center of mass do?
01:26Well, center of mass makes it so that you could determine the center and the
01:31center could even be outside of the object and we can do cool things with that.
01:37With that object selected, once again I will hit the 4 key to look at wires.
01:41I want to go to my Channel box and open up that Rigid Body node if it isn't already open.
01:45Here it is, Rigid Body, and you will see Center of Mass X, Y, and Z and those
01:52values are calculated relative to the local space of the object.
01:58If I set Center of Mass Y that means it's going to move the center of mass
02:03up and down relative to the object, not up and down in the world but
02:08relative to the object.
02:10If I set Center of Mass Y to let's say instead of 20 I will give it a value of 100.
02:16Now the center of mass is actually way out here and that's not going to look like much.
02:21If I try to play that back then that's going to look really strange.
02:24That's not really a useful result.
02:26But I could do something useful with this. I could take that center of mass and
02:29bring it down maybe to the bottom of my bowling pin and by doing that I could
02:33make it so that the bowling pin would never fall over.
02:36I can adjust Center of Mass just like Channel in the Channel box, select the
02:41name not the number and middle mouse drag.
02:45Now you can't pick up the center of mass and move it with a manipulator in the viewport.
02:50This is your only way of moving the center of mass.
02:53It is either numerically or through the Channel box sliders.
02:57What I have done here is I've placed the center of mass below the bowling pin.
03:02Press the 5 key so we can see that better.
03:04Rewind and press Play and here you go.
03:08They don't fall down.
03:09Now I can extend my Timeline a little bit, so we can really verify then in fact
03:14it will never fall over.
03:15It may take a while for it to eventually settle down, but it will
03:19eventually settle down and that's simply because I've moved the center of mass to the
03:24bottom of the object.
03:25So essentially it's heavier there and that's the way the Weebles toys work as
03:29well, they have got a metal weight at the bottom of wooden egg and that metal
03:33weight is causing it to be heavier at the bottom, moving the center of mass down
03:37and making it so that it will never fall over.
03:40In this case this is sort of a special effect;
03:43we are kind of exploiting the center of mass to do something interesting with it.
03:46Usually the default position is okay but it is important for you to know where it is.
03:52When you get into using Dynamic Constraints you'll need to consider the center
03:55of mass once again because that'll be the center around which Dynamic
04:00Constraints will be calculated.
04:02So basically I just want to move that back up where I had it, I will press the 4
04:07key so I can see the wires and I will just position that roughly in the center once again.
04:11Maybe I will rotate my pin back straight up. That's good;
04:16we've got our center of mass sorted out.
Collapse this transcript
Setting an initial state
00:00We want to set an initial state for the dynamic objects.
00:05The initial state is the position, orientation and velocity of the object at the
00:11first frame of the simulation.
00:14What is it doing at the beginning of the shot?
00:17Currently I have got all my objects in the air and when I press Play they land.
00:22What I want to have happen is I want them to be fully settled down and in
00:26contact with the floor on Frame 1.
00:29Now you might think that one way to do that would be to simply select your
00:33object and just kind of move it down until it's touching. This is not really a
00:37good way to do this.
00:38For one it might actually be overlapping. If I tap the Spacebar and go out here,
00:43you might actually be overlapping the ground plane and if that's the case at
00:48Frame 1 then that's going to break your simulation completely. You can't have
00:53objects overlapping in a Dynamic Simulation; they just won't work properly. They
00:58have to be separated and not touching.
01:01You think all right, well I'll just move it up a little bit and that way it's not touching.
01:05Well, actually you can't see it, but there's actually a distance between these
01:09two at which they'll be considered to be touching.
01:13In other words, there might be a tolerance of let's say 1 millimeter and if
01:17they're closer together than 1 millimeter then Maya thinks they're touching.
01:21They're farther away than a millimeter than Maya thinks they are not touching.
01:25The simple thing to do is just to set the initial state, drop the objects on
01:29the ground and then say boom, this is your new start point. That's exactly what
01:34we'll do here. So I'll just play my simulation until everything is settled down
01:40and for heavy scenes it may take a long time to play through. You may need to
01:45rewind and actually step through one frame at a time, until your simulation settles down.
01:53Again, that's for really heavy scenes that have a lot going on.
01:56This one's a pretty lightweight scene, so don't really need to sweat it too much.
02:01As long as I play that through either in real time or one frame at a time until
02:07they're completely settled down. Then I'm ready to set their initial state here I am on Frame 46.
02:14So whatever these objects are doing on Frame 46 that will be their new state at Frame 1.
02:22So I can select one or more of these objects. Maybe I'll just actually select everything.
02:26I've got all of my high LOD objects hidden and I have only selected the low LOD
02:33pins as well as the ball and I'm parked on Frame 46 and everything settled
02:39down, I'll go up to the Dynamics menu set and choose Solvers>Initial State>Set for Selected.
02:49Now I want to warn you that there's no way to remove the initial state for
02:53this Dynamic System.
02:54In other words, once you do this you can't go back.
02:58You could move the objects, you could rerun a simulation and you could set a
03:02new initial state, but you can't really remove the initial state for the rigid bodies in Maya.
03:08You can do it for nCloth and other forms of Dynamics, but just not this one.
03:12So I'll choose Set for Selected and then when I hit Rewind, now all the objects
03:18are touching the ground on Frame 1 and when I press Play basically nothing
03:22happens-- they kind of drift around a little bit there, but not enough that
03:26anyone would ever notice.
03:27And that's very important. Even
03:29if your animation isn't starting with things sitting on the ground, it's just a
03:33really good idea that you establish an initial state that way you'll always be
03:39able to get back to that point by just rewinding.
Collapse this transcript
Imparting initial velocity
00:00We're ready now to actually create some animation with our little bowling alley.
00:05We need to get that ball rolling down the lane.
00:09Now we can do that in multiple ways, we could create keyframes on the ball and
00:13then key it's active attribute.
00:15However, the simplest thing to do here is to simply apply an initial velocity
00:20that will be the speed of the object at the first frame of the animation. I'll
00:26select the ball and scroll down on the Channel box and open up that Rigid Body
00:31node and you will see Initial Velocity X, Y and Z right up at the top.
00:35These values will cause the object to move in whatever cardinal direction in X,
00:42Y or Z space and a positive value will cause the object to move in positive X or
00:47positive Y and negative value would cause it to move in the negative direction.
00:53In my scene currently I want the ball to move this way and that's actually
00:57negative Z in my scene.
01:00I need to give a negative value to Initial Velocity Z: let's try value of
01:05-100. Rewind and play that back and you'll see it is rolling along, but it
01:12doesn't have enough velocity to actually get to the end of the lane and knock over any pins.
01:18It needs a greater negative Z velocity to do that-- rewind-- let's try a value of
01:25-500, rewind and play back.
01:29So now it's actually moving forward and knocking over some of those pins.
01:33The reason why these values are in the range of 100 is because that's the
01:37magnitude of our gravity.
01:39Gravity is kind of setting the tone for the whole simulation.
01:43If the gravity magnitude is in the range of let's say 1000 then all the
01:48other forces in the world are going to need to match that in order to have an
01:53effect. If this had initial velocity of -1, it would not even move at all, because
01:58it would not even overcome the strength of gravity.
02:02So if I really want this thing to really get kicking across there, maybe I could
02:06try value of -1000 and rewind and press Play.
02:11How about even greater, how about a -1500?
02:16Just turn it up until it does what you want. Basically it's a bit of a trial and
02:20error process, but that kind of works.
02:24You'll notice by the way that I am not able to get a perfect strike this way. I
02:28can't knock down all 10 pins by hitting the front pin.
02:32The layout of the pins has been designed that way, so that's hard for you to get a
02:36strike. You need to actually come in on an arc in order to hit the pins at an
02:41angle and I'll be showing you how to do that later with Fields.
02:45So we got initial velocity in there, it's basically doing what we want.
02:49The initial velocity will be applied on Frame 1 of the simulation.
02:54If you need the initial velocity to be applied at a different point in time
02:58there are ways to do that, you can keyframes the impulse values here or as I
03:03said earlier you could keyframe the object directly and then key its active
03:08attribute and we'll be looking at those techniques later.
Collapse this transcript
2. Directing a Simulation
Improving performance with stand-ins
00:00In this chapter we'll be looking at directing the simulation, controlling it, making it do what you want.
00:07In a simulation, really, you have to set up initial conditions and let it play through
00:12and you can't really finely control the behavior of an individual object very well.
00:18That means it's very important that those initial conditions that you set up be good conditions.
00:24Remember, in the first chapter I've showed you how to use proxy objects to speed up a simulation.
00:30What I've done here is I've deliberately used super heavy objects in order to show you the
00:35problems that you could have, and to show you a quick solution to that or at least for
00:40testing purposes, how you could use a stand- in which will calculate much more quickly.
00:45Let's take a look at these pins here that I have made, these super heavy ones. They're very, very dense.
00:50They've been smoothed a couple of times.
00:53Let's look at the actual poly count while we're at it.
00:56I'll go to the Display menu, go to Heads Up Display and Poly Count with that one pin selected,
01:04I've got 20,000 triangles on that one pin. This is just not going to play back very well.
01:11I am going to turn that Heads Up Display back off again, and let's take a look at what happens
01:16when I try to play through here.
01:19So it goes up until just before the point of impact then it appears to stop, and then
01:24it sort of plays through.
01:26If you open this scene up on your own computer, depending upon how fast your computer is,
01:31it may not play at all, and it's really common actually with these dynamics that you'll see
01:37something like this where it will go up to the point just before impact and then appear
01:42to freeze or stop, and it may actually take minutes to calculate just one frame of the simulation.
01:50What can I do here to make this better?
01:53Well, aside from of course doing it properly by using proxy objects, one thing I can do
01:57just has a real quick band-aid fix on this is to use a stand-in.
02:03A stand-in is a built-in primitive that's part of the Rigid Body node, and when you
02:09enable stand-ins, it'll calculate based upon a bounding box or based upon a sphere rather
02:15than the actual form of your object. I am going to select all these pins.
02:20These are the high LOD pins, and I've put them on a layer.
02:23I can actually just select them via the layer by right-clicking and choosing Select Objects.
02:30You could do it anyway, you could go and select them through the outliner however you want,
02:33but I just want to select them all because I can then go into the Rigid Body node and adjust these attributes.
02:42Like anything in Maya, if you have multiple objects of the same type selected then you
02:47can go on to the Channel box and change their attributes all at once. It's very handy.
02:52What I want to do here is I just want to scroll down--I'm looking for Stand In, here it is,
02:58Stand In--and it's set to None which is the default.
03:01With no stand-in, the collisions are calculated based upon the actual shape, but if I choose
03:07a Stand In of Cube or Sphere, it's going be a much simpler calculation, and of course
03:13it will be much less accurate because it's just calculating in the bounding box that's
03:17just big enough to enclose that object.
03:21So I rewind and play that back and you'll see there's a huge difference.
03:25Now it's not very accurate, once again, it's kind of sloppy, but this is good for testing
03:30purposes, because when I just turn on Stand In I can get a really quick feedback on whether
03:36my simulation is kind of in the ballpark of working correctly, and sometimes you just
03:42actually can't playback your simulation in real time and you will be forced to use stand-ins from time to time.
Collapse this transcript
Disabling rigid body nodes with Ignore
00:00Here's another really helpful attribute for the Rigid Body node, it's called Ignore.
00:07Basically it does just what it sounds like it causes that particular Rigid Body
00:11node to not function. It just turns it off essentially.
00:16And why would we want this?
00:17Well, when you're testing scenes sometimes you need to turn certain things
00:20off and turn other things on while you're working on them just for
00:23performance reasons.
00:24Here is a really good example of why you would need to use Ignore.
00:29I have got my super heavy pins here, the ones that are ultra high level of detail
00:34and I am doing that just that we can see the problem of poor performance here.
00:40My bowling ball's taking forever to get down there; it's only going at 2 frames
00:45per second to get all the way down there and the reason why it's going so slow
00:49is because it's actually calculating collisions with the pins, even though the
00:54ball is way over here it still has to test every polygon on the ball to see if
01:00it's touching any of the polygons on the pins.
01:03Well that's problematic, because really it's nowhere even near those pins.
01:08What we want to do is we just want to make it so that the ball will roll at a
01:13more or less real-time speed that way we can test our animation and see if it's
01:17moving at the right speed and doing what we want and then when it gets closer to
01:23the pins than we can turn on the collisions with the pins and have the rest of
01:27that animation happen. I'll rewind back to Frame 1. I want to select all those
01:32pins and I can do that because they're already on a layer, and I'll just right-
01:36click and choose Select Objects. They're all selected now.
01:40Scrolling down in the Channel box down near the bottom you'll see Ignore and
01:44it's off, which means they're not being ignored.
01:47And if I turn that on either by typing in the word On or typing in the numeral
01:521, I'll press Enter.
01:55Now when I press Play the ball goes much faster and of course it goes right
01:59through the pins and bounces off that back wall.
02:01We ignored the pins, but what we really want to do is we want to ignore them
02:06only for the first part of this animation and then when we're ready for that
02:10collision we'll just turn the Ignore back off again, we can keyframe the Ignore value.
02:16I'll go back to Frame 1 and I want to keyframe the Ignore on at Frame 1;
02:23I'll right-click the name and choose Key Selected.
02:26Note is very important that I did not press the S key on the keyboard to
02:32keyframe that channel.
02:33The S key is going to keyframe all of the Transforms for the selected
02:39objects and it won't actually key- frame any of these Shape node attributes
02:44like the Ignore attribute.
02:46So I'll play this through and what I want to do is keyframe the Ignore back off
02:52again when the ball gets near to the pins, but remember I can't scrub here. It
02:58doesn't really work very well; it's really inaccurate.
03:01To find the proper frame in time what I want to do is just rewind back to
03:06Frame 1 and look at this in the top view. So I'll tap the Spacebar here and
03:12look in the top view. I want to get in really close and step through the
03:17animation one frame at a time, because it's not really going to take that long
03:21for it to get down there.
03:23Somewhere around frame 20, 25, somewhere in there maybe I can turn the
03:28Ignore back off again.
03:30At around frame 34 I guess where I am at. I want to leave a little bit of
03:35wiggle room there and then I'll select those pins once again making sure that I
03:41am not selecting the ground plane Ctrl+Click to make sure that that's not
03:45selected and scrolling down in my Rigid Body nodes-- here we go Ignore on Frame
03:5134 in my case-- I'll set that to off by typing in a 0, press Enter and don't
03:57forget I've got to key it.
03:59So I'll select the name Ignore and then right-click and Key Selected.
04:03Here is a keyframe that starts the Ignore and here's the keyframe that ends
04:08the Ignore and what I have done is I've basically optimized my shot so that the
04:13ball moves at a good rate of speed during the first part of the animation and
04:18only starts slowing down when it gets close to those pins.
04:23Keyframing the Ignore attribute is very useful to speed up your workflow, so
04:27you're not sitting around waiting for the same simulation to calculate over
04:31and over again.
Collapse this transcript
Adding bounce
00:00Let's play around with some of the Dynamic properties of the Rigid Body node.
00:04First of all, bounce or bounciness.
00:07That's pretty self explanatory. I play this back and you'll see that my bowling
00:11ball is bouncing a little bit.
00:13We of course, can control the amount of bounce.
00:16For any Rigid Body node active or passive you can scroll down in the Channel
00:21box, and you're looking for-- here it is-- Bounciness, and the default value is 0.6
00:27and the range is from 0 to 1.
00:30If I set the bounciness down to 0 then you might expect that we would get no
00:34bounce. You want that and play it back.
00:36But you see it did bounce a little bit and the reason is that the ground
00:41plane of the bowling alley lane has a bounciness attribute as well, because
00:45it's a passive rigid body.
00:47If you want no bounce at all then both of the objects have to have a bounciness of 0.
00:53I've got my ground plane selected and I'll set that bounciness down to 0 and
00:58rewind and play that back and you'll see literally no bounce and it just lands.
01:03What I recommend is that you set the ground plane's bounciness to an average
01:09value that works best for all the objects that might collide with that ground
01:14plane and the default of 0.6. In this case I think it's a little bit high. I am
01:19going to set the ground plane bounciness down to about 0.4, press Enter and
01:26then rewind and play it and with the ground plane with a bounciness of 0.4 and
01:33the bowling ball with a bounciness of 0. It's looking better I think maybe just
01:37a little bit of bounce on the bowling ball maybe a 0.2 and I think that feels a
01:45little bit better than what we have the first time, where it seemed like with
01:49the default values of 0.6 it was bouncing too much and it didn't really feel
01:52heavy enough.
Collapse this transcript
Adding friction
00:00Another essential dynamic attribute of the Rigid Body node is Friction. That of
00:06course, is the resistance to movement when two surfaces touch.
00:12Let's adjust the friction on this because I think there's not enough really. It
00:16seems like it's sliding around a bit too much. I'll rewind and I want to
00:21select all the pins they're in my Dynamics layer now, I'll just right-click
00:26and then select the objects.
00:29Look for the Rigid Body node in the Channel box, scrolling down just where we
00:32saw Bounciness then nearby you'll see Static Friction and Dynamic Friction.
00:38Usually these will be set to the same value. If I set them both to 1 and rewind
00:44and play them back, you'll see that the pins kind of want to stick in place and
00:49they'll actually get knocked over rather then fly across the space.
00:53There is also friction for the ground plane too.
00:56So if I select that ground plane, increase its friction--
00:59static and dynamic-- both up to 1 and rewind and play that back.
01:05That's really strange, isn't it?
01:06That's a very unrealistic look because we've tweaked out the settings to
01:10really extreme settings.
01:12Now what is the difference between static and dynamic?
01:16Static friction is the force that must be overcome in order to get the object
01:22moving from a resting position.
01:26In other words if the object is sitting in place and you have a high static
01:30friction then it won't be as likely to move.
01:34If the object is sitting in place and it has a low static friction then it'll be
01:38easily pushed out of the way.
01:40Dynamic friction is the force that must be overcome for an object to continue moving.
01:47Once it's in motion that's when the dynamic friction is relevant.
01:52If the object is sliding across the floor with a low dynamic friction it will
01:57just slide without stopping, but with a high dynamic friction it will slow down and stop.
02:03Again, usually you'll set them both to be the same value.
02:06I think what I want here is something a little bit higher than the defaults.
02:11I'll set the ground plane's frictions back to 0.2 and then reselect my pins right-
02:18click and select Objects and I'll set those to let's say 0.4 and press Enter
02:26rewind and play that back.
02:28I think that works a little bit better in this case. This is going to be up to
02:32you to decide what looks good in your own simulations.
Collapse this transcript
Adjusting mass
00:00Continuing with our survey of the most important dynamic attributes for
00:04the Rigid Body node; next is mass.
00:08Mass is essentially, the weight of the object although it doesn't really work
00:12the way mass does in the real world.
00:15These simulations are not truly actually physically accurate; they're just an
00:19approximation of the way things work in a real world.
00:23And for mass, what it does is it has to do with how collisions take place. Let me illustrate.
00:31I've got my ball and it's currently got initial velocity of -1200 in Z. We will
00:39play that simulation back.
00:42Scrolling down a little bit further you will see Mass and it currently has a
00:46value of 1, and by default that's 1 kilogram.
00:50But really it's not a physically accurate value;
00:53I'll set that mass up to a value of 10, and rewind and play that back.
01:00And interestingly the speed of the initial velocity didn't change.
01:05This is how it's different from the real world.
01:07If you increase the mass of something in order to get it moving you have to push it harder.
01:12So you might think that by increasing the mass then I would need to increase the
01:16initial velocity as well, but that's not the case.
01:19The mass only affects collisions;
01:22it also affects things like dynamic constraints too.
01:25But in this case all we were concerned with is the collisions, and essentially
01:29what this is doing is when that ball hits the pins, it's hitting the pins 10
01:35times harder than it was before.
01:37That's why they're jumping around so much.
01:39And additionally you notice that the ball bounces off the back wall a lot
01:43harder, because it has a greater mass.
01:46If I reduce its mass let's say to 0.1 and play it back, it bounces off the pins
01:53because it's as if that ball is a feather now.
01:56And additionally mass is not really an absolute value.
02:00I said that it was a kilogram but that's just a nominal value.
02:03But really all that matters is the ratio between the masses of the colliding objects.
02:11In other words if the ball has a value of 0.1 and my pin has a value of 1 then
02:18the pin is 10 times more massive.
02:21If I change these values so that the pin had a value of 10, and the ball had a
02:28value of 1, it is still 10:1 ratio.
02:32I've just bumped it up by an order of magnitude but it's not the absolute value
02:37that matters, it's the ratio between the values.
02:40So we'll get the same result basically.
02:43You will notice that this first pin knocked the other pin out of the way there
02:47because this pin has a mass of 10 and this pin has a mass of 1 still.
02:53I'll go ahead and select this one.
02:55Set that back to a value of 1, so that it matches the rest of the pins and then
03:00select the ball and instead of a value of one maybe I'll give it a value of 2
03:05which means the ball is now twice as massive as the pins.
03:10It's moving at about the right rate of speed and it's applying about the right
03:15amount of force because in the real world a bowling ball is approximately about
03:20twice as heavy as a bowling pin.
Collapse this transcript
Applying damping
00:00One of the less obvious but still very useful attributes of the Rigid Body node is Damping.
00:07Damping allows you to apply a chill out factor to the simulation,
00:12essentially slowing it down and kind of mellowing it out.
00:16And its purpose is usually to prevent jitter or to cause a moving object to
00:23eventually slow down and stop, because otherwise it might just keep moving.
00:27Let's take a look at how Damping works.
00:30I'll select the ball and press Play with no Damping applied and you see what
00:35happens is it kind of spins around back there and that looks kind of strange.
00:38I'll stop and rewind, with that ball selected I'm going to go to the Channel box
00:43and in the Rigid Body Shape node, in that same area we saw a Friction and
00:47Bounciness, here it is, Damping.
00:50I'll increase the Damping to a value of 1, play that back.
00:55You can see that that's a much better result;
00:57the ball slid across the floor, knocked over some pins, and then slowed down and
01:02stopped like it should.
01:03What Damping does is with each successive frame of the simulation, it
01:09essentially reduces the amount of velocity carried over from the previous frame
01:14and the higher the Damping value, the more loss in velocity.
01:19I'll rewind that, let's try setting the Damping up to 10;
01:23that's really an extreme value but it will illustrate how it works.
01:26So you can see with the damping of 10, the ball didn't even have enough force to reach the pins.
01:34Useful values for Damping are usually between 0 and 2.
01:382 is actually probably too high in this case I think with a value of 1 I was fine.
01:44I could apply Damping to the pins as well in the same manner, I set this back down to 1.
01:50Again Damping is very useful especially if you've got a simulation that's a
01:55little bit overactive and it's doing too much and you need to kind of dial
01:59it down.
Collapse this transcript
Tuning rigid body solver attributes
00:00Up to this point in this title we haven't seen too many problems with the
00:04simulation and that's actually because I've changed some of the Solver
00:09attributes to tune it to this scene.
00:13All the scenes that you've opened up so far have been tuned so that
00:17they'll play back properly.
00:19However, that's not the default when you first create a simulation.
00:23You need to learn how to tune the Solver attributes so that you don't get wacky
00:27results like this, things falling through the floor, some of these objects
00:34lighting up and then getting stuck inside one-another.
00:37These are problems with Maya's Rigid Body Solver and this happens all the time.
00:44Don't be alarmed; we do have the tools to fix this and prevent this happening.
00:50I want to mention that when these things light up during the playback of this
00:54simulation, it means that there's been some interpenetration: in other words two
00:59of those rigid bodies have passed through one another and that's of course an
01:04illegal condition for the simulation.
01:06Therefore, Maya selects the objects to warn us and say, "Hey! There is an issue here."
01:12You will also see the back down here in the script area;
01:16it's saying, "Rigid Body Interpenetration Occurred."
01:20So how do we fix this?
01:22You could play around with things like the velocity of your objects or
01:26maybe even the density.
01:29In other words, if I highlight one of these and show you it's got an internal
01:33structure-- it's got a certain number of polygons.
01:35Maybe increasing the number of polygons might help with the Solver calculation.
01:40In other words, you have more points for it to collide with.
01:44But that's not really an optable solution because the more you increase the
01:49level of detail the slower your simulation is going to run, and it will actually
01:53compound the problem, rather than make it better.
01:55What we need to do is get a handle on the Solver attributes themselves.
01:59And you can access that by just going into the Dynamics menu set to
02:04Solvers>Rigid Body Solver Attributes.
02:08We've only got one Rigid Body Solver in the scene right now and when I click on
02:13this it's going to load the Attribute Editor and expose that Rigid Solver node.
02:18Here are the attributes that are most important: Step Size and
02:22Collision Tolerance.
02:25Step Size is the time-based accuracy; how many times per second does Maya test
02:33the position orientation and velocity of the rigid body objects?
02:37Lower numbers to the Step Size mean more samples per second, meaning a higher
02:44accuracy to the simulation.
02:47Lower values equal higher accuracy.
02:51Higher values give lower accuracy, but faster performance.
02:57Here is a weird paradox around this.
03:00Somehow lowering the accuracy improves the result.
03:05I know that's completely backwards but that's just a fact because I've
03:09observed it over the years.
03:10So Step Size is the time base. Collision Tolerance is the spatial accuracy,
03:17that's how far apart two services are allowed to be before they are considered
03:22to be touching and currently it's at 0.03 centimeters.
03:27Well as I said sometimes increasing these values will actually improve the simulation.
03:32I'm going to set the Step Size up to a value of 0.1, rewind and play that back
03:39and see if that helped.
03:41Didn't really do much, rewind, go back to that Rigid Solver node, maybe
03:47increase the Collision Tolerance as well to 0.1.
03:52Rewind, playback, and there you go, I've got a much better result.
03:57It's not a perfect result-- I've turned the Damping off here so you can see that
04:02that's still sliding around-- but that's the key, it's playing around with those
04:05Solver attributes and paradoxically higher values are less accurate but yet
04:14somehow give better results.
Collapse this transcript
Adding a Radial field
00:00We want to direct this animation to get a desired result, and that is to knock
00:06down all 10 pins to get a perfect strike.
00:09To do that I want to make the ball move in arc so that it curves around here and
00:14strikes the pins from the side.
00:15I can use a Radial field to accomplish that.
00:19A Radial field is a field that pushes or pulls dynamic objects.
00:24This time I'm going to create the field without any connections so that I can
00:28show you how to connect objects to fields after the fact.
00:32I'll just go ahead to my Dynamics menu set and choose Fields>Radial and it's
00:37created right at the Origin which is nearly where I want it.
00:40I just want to move it up a little bit, give it a little bit of elevation so
00:45it's not sitting right on the floor.
00:46And now I want to show you a new window where you can make or break connections
00:51to Field to other dynamic objects.
00:52It's under Window>Relationship Editors> Dynamic Relationships; open that up and
00:59on the left I want to select the dynamic objects, the ball in this case.
01:03So I want to find the ball and click on that and then all the fields are listed
01:08on the right-hand side.
01:10This is showing me that the ball is currently connected to the Gravity field,
01:14but it's not connected to the Radial field.
01:17To connect it all I have to do is click here and if it's highlighted that
01:21means it's connected.
01:22To disconnect it, once again just click.
01:25There we go, that's the Dynamic Relationships Editor.
01:28I rewind and play my simulation but you'll see that the Radial field is not
01:33having any effect right now and the reason is that that Radial field's values by
01:38default are not sufficient to give the result that we want.
01:42In the next movie we will adjust the Radial field attributes to get a
01:46desired result.
Collapse this transcript
Limiting a field with Max Distance
00:00We've added a Radial field and we've connected it to the ball but when we play
00:04the simulation we're not seeing any result here.
00:07We need to adjust some of those radial field attributes.
00:10Also the position of the radial field makes a huge difference, so even if
00:15you just move it by a tiny amount it could affect the result: it's extremely sensitive.
00:22Not seeing any result right now but we'll play around some of the attributes.
00:25With our Radial field selected here I'm in the Channel box and you'll see the Magnitude.
00:31Let's try a Magnitude of 500. That's pretty strong.
00:35Rewind that and play that back and I still don't see any result and the reason
00:39why is this attribute here, Max Distance, that's the extent of the field's range
00:46of influence, it's a radius value.
00:48Anything that's a greater distance away than the Max Distance will not be
00:53affected by the field.
00:55Currently it's got an invisible bubble around it that's about 20 centimeters.
01:00Let's try increasing that Max Distance up to let's say 200, rewind and playback
01:07and now you'll see the ball actually bounced right off.
01:11Not only did it bounce off, but if you look closely you'll notice that it's
01:14actually accelerating away.
01:18So what is Max Distance?
01:20It's just the radius of influence.
01:23Anything farther away than 200 centimeters won't be affected.
01:26Well maybe I don't need quite so much Magnitude, maybe I can bring
01:30the Magnitude down.
01:31Rewind and see what happens.
01:33So you see that these attributes are very sensitive.
01:38You have to play around with them and sort of find the perfect storm and the
01:42magic values of combinations that do what you want.
01:46But in order to do that you need to understand what they do.
01:50So I found a result here that sort of works in this case. I've got a Magnitude
01:55of 300 and Max Distance of 200, and maybe if I move the field around I can kind
02:00of play around and see what I can make happen.
02:03So you see there just having moved the field over a little bit has had a huge influence.
02:07I'll move the field even further over; that's going to cause it to react
02:11even more strongly.
02:14So it takes a little bit of getting used to, because the ball is moving in a
02:18straight line in the negative Z axis, it's really overtaking this Magnitude.
02:24But when the field is positioned over here that Magnitude is operating kind of
02:28perpendicular to the vector or the direction the ball is moving in.
02:35So that's Max Distance.
Collapse this transcript
Softening a field with attenuation
00:00Another really important attribute for fields is Attenuation.
00:05Attenuation is the fall off, and with a value of 1, which is the default, the
00:10intensity of the field diminishes linearly from the field location to the Max Distance.
00:19In other words, it's going to be at full strength at the location of that field
00:24and it's going to fall off in intensity until it reaches the Max Distance where
00:29the value will be 0.
00:31If the Attenuation is set to 0 that means it's turned off and instead of a
00:36soft fuzzy boundary around the field, you're going to have a hard-shell around
00:41that field and any object that gets 200 units away from that field this is
00:47going to bounce right off.
00:48Rewind and to play that back, so you see it bounce right back towards me,
00:52whereas with Attenuation of 1, it was allowed to pass through. It deviated the
01:01path because there's a soft boundary around that field there.
01:06You'll need to work with all of these attributes to get a good result.
01:09You'll need to set the appropriate Magnitude, Max Distance and Attenuation for each field.
01:15And every scene is different. That means you're just going to have to take the
01:20time to adjust all those attributes for every scene that you make.
Collapse this transcript
Adjusting field attributes with manipulators
00:00Although we have full control over the Max Distance and other attributes from
00:04the Channel box, using this method it's hard to visualize what that distance is.
00:10Here's a handy trick that can help you with that.
00:13We can turn on the Show Manipulator Tool.
00:16With the Field selected I'll click Show Manipulator and you'll see in the
00:20viewport here we've got a visual indicator of the Max Distance, the Attenuation
00:24and the Magnitude and I can click on any of these and move it.
00:27And you'll see it's changing that value in the Channel box here.
00:32And what I really want actually is I want to have a pretty large Max Distance of
00:36somewhere in the range of 200 or 150, but then I actually want to move the field
00:42over to the side and reduce its Magnitude.
00:46And again I can do that from the manipulators too.
00:48With a low Magnitude and a high Attenuation it's going to cause the ball to
00:56softly arc through here; it's not going to have a hard bounce effect.
01:01Notice, by the way, as I bring that Magnitude down, it wants to snap back up here.
01:06It's not changing the value when it does that, it's just purely visual
01:09indicator on the screen.
01:12Okay let's try that.
01:13So I've got a pretty low Magnitude and that's actually good because it's kind of
01:17deviating the ball a little bit, it's just kind of pushing it over slightly.
01:22And to finally get this to be a perfect strike what I want to do is the ball
01:26itself, I want to move that over a little bit to one side and start its Initial
01:33Velocity on a diagonal.
01:35And then when it gets down here it's going to sort of softly bounce off that
01:40field and kind of arc around back to the left in this case.
01:46So I need to start to figure out what my Initial Velocities need to be.
01:51I need to move in positive X if I want to move in this diagonal here, but a
01:56low positive X value.
01:58I've got a negative Z of 1800 and let's do a positive X of 100, play that back.
02:09Pretty close!
02:10I think maybe if I increase my field strength I can get that landing where I want.
02:16Let's try a Magnitude of 50, play that back.
02:20This is just the tweaking phase where you've got to adjust all the variables.
02:24That's not perfect, but that's pretty close, I did get a strike.
02:29And from this angle we don't see a very good arc, but from a more conventional
02:35angle it might look fine.
02:36If I really needed a perfect arc then I could actually play with that some more.
02:42But at this point we've got essentially the result that we want.
Collapse this transcript
3. Working with Keyframes
Disabling solver evaluation
00:00In this chapter on Rigid Body Dynamics, we'll be looking at integrating
00:04keyframes with a Dynamic Simulation.
00:07So we can integrate keyframes in several different ways, we can keyframe the
00:11strength of fields, we can keyframes attributes such as Ignore and we can also
00:17animate an object with traditional keyframes methodology and then let the
00:22Dynamics takeover at a certain point in time by keying the active attribute.
00:27We'll be learning all those techniques in this chapter.
00:30In order for any of those to really effectively work you actually have to turn
00:34off the Rigid Body Dynamics engine while you're working on keyframes.
00:40And the reason for that is of course that you can't really scrub in the
00:45Timeline, and if you do, simulation is just going to break; it won't work.
00:50And we'll also have performance issues.
00:52Sometimes if you've got a heavy scene and you try to like skip forward to a later
00:56point in time to set a keyframe, you'll be sitting there for a really long time
01:00waiting for the whole thing to calculate.
01:03In order to prevent all those worries, we're just going to turn off the Rigid
01:07Body Dynamics Solver globally while we create keyframes.
01:12It's easy to do that: you just go up here to the Main menu to Modify>Evaluate
01:18Nodes, and you'll see that lots of different things are in here such as Inverse
01:22Kinematics and so on. I just want you to turn off Rigid Bodies while you're
01:27creating keyframes, and to do that simply just click that little X box.
01:33I do want to warn you that this menu at least in the past has been in my
01:38experience slightly unreliable and the state of that X box may actually not
01:45indicate the true state of whether Rigid Bodies are on or off.
01:50But you can tell pretty clearly and pretty obviously if the Rigid Body
01:54Simulation is turned off, because obviously none the dynamics are working
01:58anymore or more precisely, we've disabled them.
02:01So that's all there is to that. We need to do that in order to move forward to
02:05create keyframes and not have issues.
Collapse this transcript
Keyframing field magnitude
00:00One fun thing you can do with keyframing attributes for rigid bodies is keyframe
00:05the Magnitude of a field.
00:07That way we can cause the field to have effect only during certain times of the animation.
00:12In this version of the bowling alley I've deleted the bowling ball and I've
00:16deleted the field that we created in Chapter 2.
00:19And I'm going to new field that only affects the pins and I can make those pins
00:25fly through the room without having been struck by anything and I can have that
00:29happen at a specific frame in my Timeline.
00:33I'll go head and select all the pins, making sure that I haven't
00:36selected anything else.
00:37And in my Dynamics menu set I'll choose Fields and we'll do a Radial field.
00:44It's created at the Origin. I'll just move it up a little bit and then in my
00:48top view I'll move it back and position it so that it's behind the pins;
00:54that'll be more dramatic.
00:55It calls the pins to fly outward.
00:58Now I have disabled Solver Evaluation-- remember here Modify>Evaluate Nodes-- and
01:05that's really the best thing to do when you're trying to set keyframes for field
01:08Magnitude. I just want to have those Rigid Bodies turned off for the moment.
01:12With a Radial field selected I'll go to a later point in time like let's say
01:16Frame 30 and I'll keyframe the value at 0 for the Magnitude, press Return and
01:24I want to keyframe that so I'll select the name and then right-click and Key Selected.
01:30Now in this case I don't want to have any Max Distance or Attenuation. I just
01:35want the field to affect all of the pins regardless of where they are or how far
01:40they are away from the field icon.
01:43To do that I'll turn Attenuation off by turning that to 0 and I'll turn Max
01:48Distance off as well not by reducing the value to 0, but in fact by flipping the
01:54switch that says "Use Max Distance."
01:57I'll just set that to 0 and that completely disables Max Distance so that this
02:01value no longer has any effect at all.
02:04And if I go a little bit later in time let's say Frame 40, I can keyframe the
02:09Magnitude up to some level.
02:11Let's try a value of 20, press Enter, then select the name and once again
02:18right-click and Key Selected.
02:20I'll rewind and in order to see that take effect I'll have to re-enable the
02:25Rigid Body Solver Evaluation.
02:28Go back up to Modify>Evaluate Nodes and tick the Rigid Body switch back on again.
02:35Play my simulation and you can see at Frame 30 it takes effect and it pushes all
02:41of those pins out of the way.
02:44And the pins are also flying because of their own inertia, with their own momentum.
02:49An object in motion will remain in motion unless acted upon by a force.
02:54So the pins are moving, but they're also being pushed along by that field on each frame.
03:00That means that they're going to continue to accelerate and move faster and faster.
03:04If we'll want that to happen, if we just want them to get knocked over, then
03:08we'll need to keyframe the field strength back off again.
03:10I am going to rewind, disable Evaluation and then go just maybe a couple of frames after.
03:19Maybe I only want them to just get kicked over.
03:23I don't recommend just one frame, maybe two frames.
03:26Here I am on Frame 42 and I'll set that Magnitude down to 0, select it,
03:33right-click and choose Key Selected.
03:36Rewind, go up here Modify and re- enable the Evaluation and press Play.
03:46So you'll see that they did accelerate a little bit and that's because we
03:50actually have a keyframe interpolation going on. In other words, between Frames
03:5530 and 40 the strength of the Field Magnitude is ramping up.
03:59All I want to do just briefly go into the Graph Editor and change the keyframe
04:03interpolation such that it will simply pop on Frame 40 without ramping up.
04:09With the field selected I'll go to Window>Animation Editors>Graph Editor,
04:13here is the Field Magnitude I'll click on that and press the F key so I can see the curve.
04:20Here we can see the keyframe magnitude increasing from Frame 30 to Frame 40 and
04:25then dropping off at Frame 42.
04:27I don't want this interpolation here, I just want it to suddenly pop to a value of 40.
04:33To do that, I'll select this first keyframe and set it to Step Tangents here.
04:39That's all there is to that.
04:41Rewind, play it back and you'll see that it's pushed those pins out of the way
04:48without that same strange acceleration that we saw a second ago.
04:51If we play with that a little bit more and increase the friction and so on then
04:55we can get maybe a little more pleasant result, but that's the essential process
04:59of keyframing Field Magnitude.
Collapse this transcript
Pushing an active body with Impulse
00:00Really commonly with Dynamic Simulations you want to have some particular effect
00:05happen at a specific time.
00:07For example, maybe I want this bowling ball to fly across the lane at a later
00:12point in time, not on Frame 1
00:14And additionally, maybe I want the ball actually dropped to the floor and then roll across.
00:20Currently now it's just flying across the screen on Frame 1.
00:25Because if you remember from earlier chapters what we did was for the Rigid Body
00:29node on that ball, we set an Initial Velocity.
00:33Those Initial Velocities are applied on the first frame of the simulation.
00:37And the first frame is determined by the global settings in the Rigid Body
00:41Solver node and of course the default is just to start on Frame 1.
00:45If I want the ball to drop and then fly across the space, I can't do that
00:49with Initial Velocity.
00:50What I'll do now is I'll just select those three attribute values and type in a
00:540, press Enter and disable the Initial Velocity. I want to make sure before I
00:59create any keyframes that my Evaluation of Rigid Bodies is disabled; I turn that off.
01:06And I want to keyframe a different attribute here which is Impulse.
01:12And Impulse is very useful because I can keyframe that to happen at a certain time.
01:16And in fact using the Position values here I could also cause the force to be
01:22applied not directly on the center of mass of the object, to some other location.
01:27We're going to leave these at 0 for this exercise;
01:30I'm just going to keyframe the Impulse.
01:33On Frame 1 I want no Impulse and I want to keyframe the Impulse X and Z, I'll
01:39select X and Z with the Ctrl key and then choose Channels>Key Selected.
01:45On Frame 1, Impulse is set to 0.
01:49I'll scroll down to let's say Frame 40 and that's when I'll want the ball to fly
01:54across the space, and I'll keyframe those values up.
01:58I'll just use similar values to what I used for the Initial Velocity.
02:02Impulse X of 100, press Enter, Impulse Z of -1800 --because remember we want the
02:09ball to move in negative Z-- press Return.
02:14Go ahead and select those and once again Key Selected.
02:18Now I only want that Impulse to be on for one or two frames, because if I don't
02:23then the Impulse will accumulate.
02:25Just like the field we saw in the last movie, it will cause the object to accelerate
02:30in a really unnatural fashion because that Impulse is being reapplied on every
02:35frame and then also adding to the inertia or the momentum of the ball.
02:40Let's see what that looks like if I re- enable my Rigid Body Evaluation, and go
02:45ahead and rewind and play that back.
02:48And what's happening again is that the ball is accelerating because that Impulse
02:53is being applied on every frame.
02:56See that in the top view, it's a little bit clear.
02:58The ball really is accelerating and picking up speed.
03:03Go ahead and turn my Evaluation back off again, scrub down to Frame 42 and then
03:10keys these values back off again 0 and 0.
03:15Select them and Key Selected, turn them back off.
03:21And then we'll turn the Evaluation back on again, rewind the simulation and play it back.
03:27You'll see we're still not quite there yet, because the ball is moving before I
03:33wanted to. Remember I wanted it to start on Frame 40.
03:36I'll go ahead and select it and go back into Window>Animation Editors>Graph
03:42Editor and here are the curves for Impulse X and Z and once again I just want
03:49to select those and set them to Step Tangents. That means there will be no interpolation.
03:55Let's see what that looks like.
03:56Play it back, so that's exactly the result I was trying to achieve. I wanted the
04:02ball to drop to the floor and then at Frame 40 to kick across the space.
04:07I could fine tune that a little bit better if I want to get a perfect strike,
04:11but that's a good illustration of animating the Impulse values.
Collapse this transcript
Keying the active attribute
00:00If you want the best of both worlds from traditional keyframing in Dynamics, you
00:05can do that in Maya simply by keying the active attribute on a Rigid Body node.
00:11We can set it up so that the object will be keyframed in the first part of an
00:14animation and then allow the Dynamics to take over.
00:17This is a really cool technique that you probably will use a lot.
00:21In this version of the scene, my ball does not have any Rigid Body nodes
00:25attached to it yet.
00:27What you usually want to do in this case is you want to create a passive
00:30rigid body to start with.
00:32We've got it selected.
00:34In my Dynamics menu set, I'll go to Soft/Rigid Body>Create Passive.
00:40And as I mentioned before, there's only one Rigid Body node type and whether you
00:45choose Active or Passive in this menu, you'll create the same node.
00:49The difference is the state of the active attribute and if I go to the Channel
00:53box and open up that Rigid Body Shape node, scroll down near the bottom, then
00:59you'll see Active and it's currently off.
01:02In this state now, I can create ordinary keyframes on the ball.
01:06However, I do want to verify that my Rigid Bodies Solver is globally disabled
01:11so I don't have any performance issues.
01:12I'll just verify it by going to Modify> Evaluate Nodes and we'll turn that Rigid Bodies off.
01:20I just create keyframes in the ordinary way, position keys in this case for that sphere.
01:26By the way, you'll see once again that these channels are highlighted in yellow
01:30and ordinarily that means that there's some incoming connection that's taking
01:34over your ability to keyframe.
01:37However that's a little bit misleading. in the interface here. That yellow color
01:42does not indicate that there's some incoming connection that's preventing us
01:46from keyframing the object.
01:48It simply means that those attributes are connected to something currently and
01:53they're connected to the Rigid Body node, but the Rigid Body node active
01:56attribute is turned off.
01:58That means we can go ahead and keyframe this and not worry about any
02:02problems coming up.
02:03I do want to keyframe it just in X and Z once again and on Frame 1, I'll select
02:09X and Z and key those attributes.
02:13I'll go to a later point in time like let's say Frame 12-- see that in the Top
02:18View-- it's a little bit clear, grab that Move tool and in half a second, how far
02:23will it have traveled? Let's say about quarter of the way down the length of the alley.
02:29And I want to key those attributes once again and rewind that, play it back and
02:35you can see, boom, the ball is moving down the alley, as we expect.
02:40Now I don't want any weird interpolation here.
02:43I want that to just be a straight line and I want it to be a
02:47linear interpolation.
02:49With that sphere selected, once again I'll go into the Animation Editor>Graph
02:54Editor and I want to press the F key to frame those curves and select them and
02:59this time I want linear interpolation, so I'll choose Linear Tangents.
03:04Now the ball will move in a perfectly straight line.
03:07So that's the first part.
03:08Now the second part that's really fun is to enable the active attribute.
03:13I'll scroll down here and here's the active attribute.
03:16It's currently off and on Frame 1, I want to key it off, select the name and key selected.
03:24We have animation up until Frame 12 and what we need to do is we need to
03:30reenable the attribute while the object is in motion in order for this to
03:35actually take over and inherit the vector-- in other words, for it to know what
03:42direction the object is moving and how fast.
03:45In order for that to work correctly, we can't key the attribute back on after
03:50the animation is finished, we need to go back a couple frames.
03:54The second keyframe here was on Frame 12.
03:57I'll just go back to Frame 11 and on Frame 11, I'll key the active attribute on,
04:04typing in a 1, press Enter, select the name and then key it.
04:11By the way you will notice that you don't see the keyframes for the actual
04:16Transforms in the Timeline here.
04:19It's just a quirk of the interface.
04:21We don't see the keyframe on Frame 12 here, we only see the keyframes for the
04:27actual Rigid Body Shape node.
04:29But if we go into the Graph Editor once again, we will see all those keys and
04:34we have got Translate X here and that's got keyframe data on it and we have got
04:39the active attribute here as well and I want to select that and press the F key
04:45and you can see that the active attribute is binary, in other words it's only on or off.
04:49There is no possibility of a transitioning with an interpolation any of
04:54these tangent types.
04:55It will always be a step tangent, because active is binary. Rewind and play that back.
05:02Cool!
05:03So now let's try seeing what we get here.
05:05Tap the Spacebar, go back out to our four -viewport layout and then we'll go back
05:10and reenable the Solver, Modify> Evaluate Nodes>Rigid Bodies. Rewind and play
05:17that back and you can see that in fact the Dynamics have taken over.
05:23I only animated the ball from Frame 1 to 12 and then I have turned the active
05:27attribute on, on Frame 11.
05:31We don't see the ball falling to the ground, because it is not connected to
05:34gravity and that's easily fixed, select the ball, select the Gravity field, then
05:40go to Fields>Affect Selected Object(s), rewind and play it back.
05:47It's basically doing what I want.
05:48If I wanted a more realistic result of course, I would probably want to animate
05:53the ball in Y, so it would fall instead of just flying through the air.
05:58But that is a very good illustration of how we can keyframe the active attribute
06:03to combine traditional keyframe methods with Dynamics.
Collapse this transcript
Baking the simulation to keyframes
00:00We've had a lot of fun playing with Creating Dynamic Simulations.
00:04When we're ready to actually render the animation, we'll need to perform a
00:08process called baking.
00:11Baking is converting the dynamic simulation into traditional keyframes.
00:16It's not an optional step; it's something that you have to do in Maya.
00:20If you forget to do this and you go ahead and render your animation, there is
00:25a good chance that what you get back from the rendering will not be what you
00:29saw in the viewports.
00:31There are a lot of reasons for this.
00:33One is that the simulation is history dependent and that means that what happens
00:38on let's say, Frame 5, depends directly upon what happened on Frame 4 and those
00:44calculations might be different each time the simulation is run.
00:48We've had pretty good luck, here with this exercise, but you'll see that
00:52it's pretty common that you may play the same simulation twice in a row and
00:57get different results.
00:59Additionally, especially for heavy scenes your render times will be much longer
01:04if you forget to bake the simulation.
01:06And that is once again, because it's history dependent.
01:09If we're on Frame 100 of our batch render, we have to actually calculate every
01:15frame of the simulation from Frame 1 to Frame 99 before we can calculate frame
01:19100. Then, we get to Frame 101, we have to recalculate everything from Frame 1 to Frame 100.
01:26So that means as your animation progresses through the batch render, each frame
01:31is going to take longer and longer and longer to render.
01:34The solution to this is simple.
01:36You just bake the simulation which will convert the Dynamics into actual
01:40keyframes which you can then edit if needed.
01:44To bake the simulation you need to select the active rigid bodies.
01:49Before you bake the simulation, set your Timeline up. I'll play this through and
01:53figure out when I need my Timeline to stop.
01:57When all those pins settle down is approximately Frame 120. I'll set the end of
02:03my playback range to Frame 120 here.
02:06Then I want to select all the objects that are going to move in the simulation.
02:12In other words, all the active rigid bodies, and in this case it's simply the
02:17ball and those ten pins.
02:20If you're not sure what's selected you might want to go into the Outliner and
02:23verify that you selected just the ball or just the dynamic objects that are
02:28moving in this case the ball and those ten pins.
02:31To bake the simulation I want to go into the Edit menu and there's a section
02:36that says Keys and you want to go to Bake Simulation.
02:40Let's open the Option box for that and look at it.
02:43We don't really need to change anything in here, but I just wanted to show you
02:47that you have the option to bake a different time range if you needed to.
02:51It defaults to the entire time slider, but could bake a different range if we wanted.
02:56And by default it's going to bake all of the selected objects and all of the channels.
03:03Go ahead and click the Bake button.
03:06The simulation will play through once and then when it's finished you'll notice
03:12that for any selected object that has keys on it there is a keyframe on every
03:16single frame, but that's what we have to do.
03:19We do need to do a little bit of cleanup here, because as I said the default
03:24behavior of the Bake Simulation tool is to keyframe all of those attributes even
03:31stuff that wasn't even animated.
03:33We'll go back into the Edit menu and we want to go to Delete All by
03:38Type>Static Channels.
03:41A Static Channel is some animation curve that has a flat line, in other words
03:47all the keyframes have the same value and the channels of value is not changing
03:52therefore it's static and I want to delete all Static Channels for the entire
03:58scene and so you see these all change back to white indicating there is no
04:03keyframe data there.
04:05Now check this out, I can scrub through my animation now. That's a new
04:09functionality that I did not have before and that's important too, because if
04:14you're animating a character for example and that same scene has dynamics in it
04:19you want to either bake the simulation or disable the Rigid Body Evaluation
04:24while you are trying to animate your character.
04:27So that's baking simulations.
Collapse this transcript
Deleting all rigid body nodes
00:00We've baked the simulation and now we can be reasonably sure that we will
00:05get reliable playback.
00:06Every time we play the simulation we'll get the same result and we render what we
00:11see is what we will get.
00:13But there's one little piece of garbage collection we need to do here, because
00:16if you notice when I press play it doesn't really play quite in real time and
00:22when I scrub through here, there is just a slight performance hit.
00:26If this were heavier scene it would be more obvious, but sometimes you might
00:30bake the simulation and then try to play it and it's still just as slow as it was before.
00:35And the solution to this is to actually just blow away all the Rigid Body nodes
00:40and delete them completely.
00:42You could disable Solver Evaluation, but I don't recommend that, because that
00:46state of the Solver Evaluation might get toggled back on again.
00:51It's better to simply just delete all the Rigid Body nodes and just blow it all away.
00:56If we need to we can get back to an earlier version if we just saved before we do this.
01:01I am going to go ahead and do the command that's going to be found in the Edit
01:05menu, Delete All by Type, and down near the bottom you'll see Rigid Bodies.
01:12Click on that and you will notice that all of the little Xs that indicated the
01:16centers of mass of all the objects have all disappeared.
01:20Now I can scrub through here and I don't have any performance issues.
01:25This is now a version that I want to render.
01:28You will see that I have got a couple fields still floating in here.
01:31I could delete them as well, but currently they're not hurting anything, because
01:35there's no Rigid Bodies for them to affect.
01:37That's the workflow for a finishing up a Rigid Body Simulation.
01:42You have got to bake the simulation and then delete all the Rigid Body nodes.
01:47But don't forget to save your Dynamic version of that before you delete the
01:52Rigid Bodies, because if you overwrite your file having deleted the Rigid Bodies
01:57you'll never be able to get back in order to make changes.
Collapse this transcript
Editing keyframes in the Graph Editor
00:00Before rendering an animation that was created with a Dynamic Simulation we
00:05might need to clean up the keyframes a bit.
00:07In this case, at the very end of the animation the pins are kind of dancing
00:11around a little bit.
00:12Let me maximize this view by clicking it and tapping the Spacebar.
00:18I'll go down towards the end of the animation.
00:20You'll see after about Frame 110 the pins should really be sitting static on the
00:26ground, but they are kind of wiggling around and moving around a bit.
00:30I can easily fix that by just deleting those keyframes at the end.
00:34I want to select all the pins, make sure I have selected nothing else, and then
00:39just scrub down here and I can figure out when I want to delete those keys.
00:44Let's say after Frame 110.
00:47To delete the keys I want to select them first, hold down the Shift key, and
00:51then click-and-drag across the keyframes you want to delete.
00:56Now they are selected.
00:57If I press the Delete key on the keyboard now, I'll actually delete the
01:01bowling pins themselves.
01:03I don't want to do that.
01:04I just want to right-click on this and choose Delete and now after Frame 109
01:12there's no motion here.
01:14However, you'll notice that they kind of suddenly come to a stop.
01:17They're dancing and wiggling around a little bit between Frame 100 and 110 and
01:25at Frame 109, boom, they just suddenly stop.
01:29What I want to do clean that up is I will leave this keyframe at Frame 109, but
01:32maybe I'll delete everything from Frame 102 to 108.
01:36If you are having a hard time selecting those you might want to zoom in a bit
01:41by changing the Range bar and I'll hold down the Shift key and I will select those keyframes.
01:49Now this is a bit misleading here.
01:50When I go all the way out to here that's not actually selecting Frame 109.
01:54I'll right-click and Delete.
01:57That Range bar only selects keyframes that are completely enclosed within it.
02:03That last Keyframe was actually on the outer edge of the Range bar and so it was not selected.
02:08I'll just play that bit.
02:11So now we got a little bit more graceful transition there at the end.
02:14So they don't seem to suddenly come to a stop.
Collapse this transcript
Simplifying animation curves
00:00Sometimes you'll need to really go in and edit the simulation data after
00:05it's been generated.
00:07Maybe you need to change the trajectory of an object, maybe you need to make it
00:11go in a different place than the simulation made it go.
00:14In that case then you'll need to edit the curves, and you do that in a Graph Editor.
00:19Select that ball in this case and go into Window>Animation Editor>Graph Editor.
00:24You can see now when I press the F key that we've got a keyframe on every single
00:29frame, and it's going to be really difficult to edit this data.
00:33However, Maya gives you a tool to simplify the curves.
00:37I am just going to focus in on one of these for simplicity's sake.
00:41The ball>Translate X, which is its position side-to-side and I'll press the F
00:47key once again to frame that curve.
00:50Because this has got so many points on, it's going to be nearly impossible
00:53for me to edit this.
00:55But all I need to do is just select that channel name and in the Graph Editor go
00:59to the Curves menu and choose Simplify Curve.
01:03There is an Option box for that and I can open that up and you can see you could
01:08a Time range and you could play around a little bit with these tolerance values
01:12and they will give you slightly different results.
01:14But I am just going to leave it at the default values right now.
01:17I will click Simplify. There you go!
01:20We've got a much easier curve to work with now.
01:23Now I want to show you that the way that it does it is not quite optimal in all cases.
01:29Let me zoom in a little bit here with Alt and right-mouse and just position the
01:35curve with Alt and middle-mouse.
01:38I just want to undo that last Simplify Command so we can compare the before and after results.
01:44I'll hit Ctrl+Z or just Z and that's before the Simplify and then Shift+Z that
01:51will redo the Command and you can see that it actually changed the shape of the curve.
01:56If I get in a really close on this we can see that maybe even more clearly.
02:01Once again it's Z to undo and Shift+Z to Redo, and it definitely changed the
02:08shape of the curve, especially here that's where it's most obvious.
02:13What's happening is Maya is basically rebuilding the curve and these keyframes
02:19initially all had autoTangents on them.
02:23When we did the initial bake command, we got a keyframe on every single frame
02:28and they all had so-called "autoTangents", which is what you see here.
02:33Then when we simplified the curve, it didn't have any information before Frame 1,
02:39so it didn't know how to set the tangents.
02:43Here on this one for example you'll see that tangent is set properly in order to
02:48try to maintain the shape of the curve instead of a flat tangent.
02:52This would be bad if we got this result out from the Simplify command.
02:57But we didn't get that.
02:58What we got is more or less an automatic curve.
03:01Once again because there was no data before Frame 1, then Maya didn't
03:06know what to do there.
03:07However, we can fix that really easily.
03:09We can select that keyframe and we can set it to a different tangent type.
03:15We can play around with these or maybe we could just select that tangent and
03:20then use the Move tool.
03:22We got the Move tool here and then just set that manually.
03:27In any event, after you've simplified you will need to go in and check the results.
03:32So now I have the ability to completely fine-tune this.
03:35Maybe I want the ball to move further over to the right and then swing back
03:40in towards the center.
03:42To do that I could just change the value of these keys.
03:45I could grab one of these and with the Move tool I only want to change the value
03:51not the time of the keyframe.
03:53So I'll hold down the Shift Key and click-and-drag here.
03:57And it helps if I position my Timeline on that frame so I can see where
04:02that's going to land.
04:03Now you can see I've pushed that farther over to the right.
04:06Maybe I'll do the same with this one holding down Shift and just move that up a bit.
04:11Now it's describing a better arc through space, at least in the first half of the animation.
04:18I can delete the keys as well too if I don't like them.
04:22So I can just select that key and just press the Delete key.
04:27I want to maintain that same value at that point of impact on Frame 28.
04:32That's kind of sacred so I want to make sure that one stays the same there.
04:36But maybe this one key had moved up a bit to get a more graceful curve.
04:40Let's check our results.
04:44That's a pretty good arc I could fine- tune that a little bit more and make it
04:49better, but essentially that's how you can edit keyframes on the dynamic
04:52simulation after you've baked them.
04:56And that concludes our chapter on integrating keyframes with Rigid
04:59Body Dynamics.
Collapse this transcript
4. Applying Dynamic Constraints
Understanding dynamic constraints
00:00In our final chapter on Maya Rigid Bodies we are going to look at Constraints.
00:05We will be using Animation Constraints, but more importantly we will be using
00:10Dynamic Rigid Constraints.
00:12Here's a Newton's cradle animation that I've created using Rigid Bodies.
00:17This is an automated animation.
00:19There are no keyframes.
00:20There's actually one keyframe which is on a Spring Constraint.
00:25It's on a hidden layer here.
00:26So I'll open that up to make it visible.
00:29That's the so-called "spring."
00:32There is actually one keyframe on that spring in order to enable or disable its
00:37ability to pull the sphere over. I'll rewind that.
00:43And when the constraint turns off you'll see that that turns into dashed line.
00:48That's the only keyframe I have in the whole animation.
00:53Then to keep these spheres in place I've used Hinge Constraints.
00:57So those are all on hidden layers as well.
00:59I'll make that visible and these are the constraints that are holding those spheres.
01:03You'll notice that they're positioned directly above the spheres and you will notice
01:09that they're not in the same position as these polygon cylinders which are meant
01:13to represent the wires.
01:16In fact these cylinders are not dynamic, they're just plain ordinary polygon
01:21cylinders, and I've used an Aim Constraint to merely point the cylinders at the spheres.
01:29So these are not actually dynamic.
01:30They're just there for show.
01:32So let's look at the scene without any of those constraints applied.
01:36I can go to File>Open Scene and I have got it here in the Exercise Files.
01:41Here it is, 04_01_start.
01:44And this again has no constraints in it currently.
01:47But what I have done here in advance is I have moved the pivot points of the
01:52spheres and the cylinders so that the Aim Constraint will work properly.
01:56Notice that the pivot point for the sphere is right at the top of the sphere
02:01and I know that because I have got the Move tool selected and then selected this sphere.
02:06That's so that this cylinder will point exactly at that location.
02:10The Aim Constraint will always point at the pivot of the constraining object.
02:15I've also moved the pivot points of the cylinders themselves as you can see here.
02:20If I turn on the wireframe by hitting the 4 key, you can see that a little bit better.
02:24I've moved the pivot point of the cylinder up to the very top of the cylinder,
02:28because that's the point around, which we needed to rotate.
02:31Press the 5 key, go back to Shaded Mode.
02:34Let's add the Aim Constraint.
02:35To add an animation Aim Constraint you want to be in the Animation menu set and
02:41select the Constrainor, or the thing that's the leader, and that's the Sphere in
02:45this case and Shift+Select the constrainee-- the thing that's going to be
02:49constrained or the follower. Go up to the Constrain menu, and we want to go to
02:55Aim, but let's open up the Option box here.
02:59If I just hit up Apply here I probably won't get the results that I want.
03:02As you see it's pointed in the wrong direction.
03:06I'll give focus to the main window and press the Z key to undo that.
03:10I just need to play around with these Aim vectors.
03:13In this case I want the negative -Y axis of the cylinder to point towards the sphere.
03:19To do that I want change these Aim vector values.
03:22The X Aim vector will be 0, the Y Aim vector will be -1, and the Z will be 0.
03:31I want to change the type of vector.
03:33In other words, this is determining which way is up in my world I want to choose
03:37Scene Up in this case.
03:38Now let's try that.
03:40I'll click Apply and that seemed to work and with the cylinder selected you'll
03:45see that these Rotate channels are in blue indicating that there's an incoming
03:48constraint on those channels.
03:51If I pick up the Sphere and move it, you will see that now the cylinder is following.
03:55I'll hit Ctrl+Z. I want to do the same for the other side here.
04:00This one is going to be a little bit different, because the pivot point on these
04:04is not actually aligned as it is on the left side.
04:06So these are little bit different.
04:08If I use the same settings here and try to make this happen, it won't work.
04:12Select these sphere, select the cylinder, and press Apply, and you'll see it's off.
04:18The reason is that I needed to enable this Maintain Offset switch.
04:22So once I'll focus in the main window, press the Z key to undo, turn on this
04:27Offset switch, and really that probably should be on in most cases.
04:32Go ahead and click Apply.
04:34That seemed to work.
04:35I'll select the sphere and move that around and now those cylinders are
04:39following these sphere properly.
04:41Press Z to undo that movement.
04:43I can close this and to repeat that process for the rest of these objects I
04:47can just use the G key.
04:50I'll select the sphere, select the cylinder, and press G. That just repeats the last command.
04:56I'll just go down the line and do all those.
04:58I've created all those constraints.
05:03I just want to test each one of these spheres and make sure that it's doing
05:07what I think it's doing.
05:09Pressing Z each time to undo. That's that.
05:13It looks like we've got Aim Constraints in place.
Collapse this transcript
Creating dynamic objects
00:00Heading out of those Aim Constraints now I am ready to create Dynamics.
00:04I'll go to the Dynamic menu set and I want to make all of these spheres
00:08active rigid bodies.
00:09So I'll just select all those spheres, go up to Soft/Rigid Bodies, and Create Active.
00:14We also need to have gravity applied. With those spheres still selected,
00:19I'll go up to the Fields menu and choose Gravity.
00:23And there's my Gravity node and move that out of the way a little bit, rewind
00:27and play my simulation, you'll see that the spheres are falling and they're
00:31falling very, very slowly.
00:33And the reason for that is that I've built my scene at 1:1 scale and the
00:37gravity is expecting this scene at 1:100th scale.
00:41To correct for that now, I'll select that Gravity field and in the Channel box
00:45I'll set that Magnitude to 980.
00:49Now I've got physically accurate behavior.
00:52Those spheres are real-world size and they're only an inch or two above the ground.
00:56So it wouldn't take them very long to fall to the grid plane.
Collapse this transcript
Creating a Hinge constraint
00:00Currently, we've got Rigid Body nodes applied to all these spheres and we
00:04attached them to Gravity nodes and now they're falling.
00:08You want to keep them in place. I'll select one of these spheres, and in the
00:12Dynamics menu set I'll go up to Soft/ Rigid Bodies and you'll see various types
00:18of constraints listed here.
00:20In fact they're all the same node type with different settings.
00:23In this case, I want to choose a flavor Create Hinge Constraint, select that.
00:29And now inside this sphere located right at its center of mass is a hinge.
00:34I'll get in closer by pressing F key and hit the 4 key, so we can see wires.
00:40Here is our wireframe view, and that's the hinge.
00:44I've built my scene, so that the hinge will be oriented in the correct direction
00:48to begin with and I will move that up.
00:53Let's go out to the front view and move that up in the front view, so that it's
00:57right at the top of those cylinders there.
00:59I don't need to rotate the hinge in this case.
01:02It should work just fine.
01:04The object will swing in this direction.
01:06If I had turned the hinge in some other direction then that would cause the
01:10object to swing that way, Ctrl +Z to undo that. Okay.
01:15I'll press 5, so I can see Shaded View.
01:18Rewind and Play the simulation, you'll see that one is holding in place.
01:22And it's swinging in this axis, very slightly.
01:26All right, I just want to repeat that process for the rest of these.
01:30Go up and add that Hinge Constraint.
01:32In fact I can use the G key once again and go around and just select and then
01:37press G, select and press G, select and press G.
01:42Now I have got all those Hinge Constraints built.
01:45I can select them easily using Window Outliner and here are my Hinge Constraints.
01:50I have already moved the first one, so I just want to select 2 through 5 and
01:54then grab the Move tool and position those up.
01:58Let's look at that in this front view.
02:00I want to try to position these all so they are about at the right place.
02:05So they're all at about the same location. Cool!
02:07Let's see what we've got. Alright!
02:12So it looks like we've got our Hinge Constraints in place and they're all
02:15oriented in the right direction causing those spheres to swivel and turn and
02:21move in the X axis of the scene.
Collapse this transcript
Creating a Spring constraint
00:00Our simulation is mostly set up.
00:03We just need to give it a kick to get these spheres moving on a Newton's cradle.
00:08We do that in lots of ways.
00:10I'm choosing to do that with a Spring Constraint to illustrate how that works.
00:13I'm going to select that center sphere and add a Spring Constraint.
00:18Soft/Rigid Bodies>Create Spring Constraint.
00:23Let's zoom in on that, I'll press the F key, press the 4 key and it is just a
00:28tiny little locator: that's the spring.
00:32And you'll see that there is a line connecting the spring to the object's center of mass.
00:37I want to move that spring way out and just moving it in the X and Y axis, not in
00:41Z. I want it to maintain this symmetry here.
00:45Move that spring out there. Rewind. press the 5 key, so we can see that, and
00:52press Play and you'll see it's pulling a little bit, but it's pretty weak.
00:57We need to increase the strength of that spring.
01:00With the spring selected, I'll go to the Channel box. Scrolling down you'll see
01:04spring stiffness. Let's turn that up maybe 100 or even higher.
01:09Rewind and play that back and you can see with the stiffness of 100, it's
01:13trying to pull those spheres towards it, but it's not oscillating and bouncing around there.
01:19What we want is we want that to just pull straight up and hold.
01:23To accomplish that, I'm going to give it a really high spring stiffness of about 500 or so.
01:29So rewind and play that back and you can see that that's really pulling them up
01:33there, but we're still getting that funky oscillation.
01:37We can tone that down by applying some Damping. So here's Damping.
01:42And let's try value of 100 for Damping.
01:46That's a very high value, but we need a high value to match the high value of that stiffness.
01:52Rewind and play that back, and that's much better.
01:54That's about what I was trying to achieve.
01:57And now what we want to do is actually animate the Constraint.
02:00We can turn it on and off at will.
02:02I want it to be on at the beginning of the animation.
02:05So on Frame 1 the Constraint attribute is on.
02:08I want to go ahead and keyframe that.
02:11Right-click and Key Selected.
02:13Let that play through for a couple of seconds.
02:17Now I let my Timeline go to about Frame 48 or so.
02:20I can step forward one frame at a time, if I want, or of course I can disable
02:25Solve or Evaluation.
02:26But I'm just going to choose to step forward one frame at a time until I get to Frame 48.
02:32And with my Timeline at Frame 48 I want to animate the Constraint off.
02:38I'll select the value and type in a 0, turn it off, then select a name and
02:43right-click Key Selected.
02:46If we look at this in wireframe, it's easier to see that in fact that's got a
02:50dashed line now indicating that the Constraint value is disabled.
02:55Play that back: see what we get.
02:56We don't quite have the behavior that we want as far as the bounciness and
03:01the movement of those spheres in the Newton's cradle, but we have this
03:06structure working and we're just going to then fine-tune that and we'll do
03:10that in the next movie.
Collapse this transcript
Fine-tuning attributes
00:00The basic structure of our simulation is in place, but as you can see, we're not
00:05seeing physically accurate results and we're just going to then fine-tune that.
00:09If we pulled this sphere over and let it go, it would actually continue moving,
00:14It would push these other two out of the way. And to do that interesting thing,
00:18where it will do three and two and three and two,
00:21we need to just adjust some attributes to make that happen.
00:24Mainly, it's all about the Bounciness and the Damping for these spheres.
00:28I'll go ahead and select all those spheres and go into the Channel box, looking
00:34for the Rigid Body Shape node and we've got Bounciness, Damping, and Friction.
00:42I need a high bounciness here.
00:43I really need those to push each other around with quite a lot of strength.
00:48We don't want a Bounciness of 1
00:50because that would actually create kind of a perpetual motion machine where it
00:53would never really settle down.
00:55I want a Bounciness of nearly 1.
00:58And I've tested this quite a lot and spent quite a bit of time trying to get
01:02this to do exactly what I need.
01:04And I think the Bounciness of 0.99, is going to work.
01:07Rewind and play that back and see what I get. That's better. It's not perfect.
01:15It starts out okay, but then it kind of gets weird.
01:19We can help that along by just giving it a little bit of Damping.
01:22And remember Damping is a chill out factor that just reduces the amount of
01:27inertia carried over to the next frame.
01:30I'll give it a pretty conservative Damping of let's say 0.3.
01:36Rewind and Play that back, that's better.
01:41It's carrying on a little longer with what I was hoping to see.
01:46I don't actually want any friction here.
01:48We don't want to lose energy in the process.
01:51So I'm going to set the frictions-- Static and Dynamic-- both down to 0. Play that back.
01:59That's pretty good.
02:00It's not perfect, but it'll never be perfect.
02:03And in fact, actually in Maya, if I wanted to make this Newton's cradle carry
02:08onward for a much longer period of time, then I would have to do it through
02:12traditional animation.
02:13The Dynamic's engine is really not quite accurate enough to produce that
02:19accurate-looking result, but this is a good demonstration of how Constraints work.
02:23We can play around a little bit with the solver settings and we might be able to
02:28get a better result by doing that.
02:30Remember it's here in the Solver menu and Rigid Body Solver Attributes.
02:35And these are just the default values, currently Step Size and
02:39Collision Tolerance.
02:40Step Size, remember is the time base accuracy and Collision Tolerance is the
02:45spatial accuracy and lowered numbers are more accurate.
02:49In the bowling alley scene that we did in the previous chapters, we got better
02:53results by reducing the accuracy, by increasing these values.
02:59Here, what I found is that it works better if I increase the accuracy by
03:04reducing the values.
03:06And if I knock this down to Step Size or time accuracy of 0.001, what that will
03:14do is create more time samples.
03:16We want to see if that give me any change.
03:18It didn't seem to really help, so I'm not really going to push my luck here, I'm
03:25going to put that back up at 0.3.
03:28It takes quite a long time to test out systems like this, especially if
03:32they've got a lot going on.
03:34And it does become a little bit tedious sometimes and you won't be able to get
03:39exactly what you had in your head, but you can get pretty close.
03:43And that concludes our chapter on applying Dynamic Constraints.
Collapse this transcript
Conclusion
Goodbye
00:00That concludes our training course in Creating Simulations in Maya Dynamics.
00:05I hope you've enjoyed this as much as I've enjoyed creating it.
00:09Maya Dynamic Rigid Bodies are admittedly not the fastest or the newest option out there.
00:15But as I've shown you in this course, you can work around those by using
00:19proxy objects and so on.
00:22Once again, I want to thank you for watching this training course and bid you goodbye.
00:27So goodbye!
Collapse this transcript


Suggested courses to watch next:


Maya Particle Effects (2h 8m)
Audri Phillips

Maya Essentials 5: Animation Tools (1h 20m)
George Maestri


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,025 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked