Join Thanassis Pozantzis for an in-depth discussion in this video Creating a crazy machine, part of Dynamics in CINEMA 4D.
I did promise you that we'll have some fun building dynamics and relations. And I think the time has come where we can actually build something, which will be fun to build and to watch play. I was thinking of something like a crazy machine. Let me show you what I mean. Tools > doodle > doodle paint, a wonderful tool. A little marble is going to propelled this way. Through a number of hoops, into a funnel. And the funnel will drop it into a slide, rotating slide, and the marble will come out the other side, at the bottom, and knock down a series of dominoes.
Okay. I think that's good to start with. And let's see how we're going to make this. Let me delete my doodle tool, and I think we can start from the slide, since it's going to take up a most of our screen space. It's going to be a very simple slide. An arc. I will zero this and make this minus 180. I've rehearsed these numbers; you can always go and play around and just put any number that you think is right. I'll make it smaller, then I'll get helix spline.
Wonderful spline. And orient it so it's upright, and then I'll take a sweep object. Okay, the first is always the profile; the second is always the sweep path. Ha. This is magnificent. I'll change my display settings. And I'll do a couple of changes. I'm going to select the sweep, which is now called slide. And in the object tab, I'm going to get rid of the banking, so it's horizontal throughout the rotation.
And the next thing, I want to simplify the polygon count a bit. I think there are few too many polygons on the slide. I will select both splines, go to the object tab and in the intermediate points, I'll change adaptive to uniform and make this two. Good enough. The shape is nicely defined, and the polygons are nice and uniformly distributed. Good. The next thing I'm going to do is add a floor.
And that will help me adjust the position of the slide. If I zoom in here, you will see when it goes through the floor. Or above the floor. We don't need to be all that accurate to be honest. Good, we have a slide and a floor. Let's go to the next thing, which is the funnel. Now because we've already got a couple of objects in our screen here I'd like to create the final in another document and then copy and paste it into this document, so I'll create a new document by pressing Cmd+N, or Ctrl+N on the PC, or I can actually go here and say New.
Go to the front view, select the linear spline. Click once, click twice, click thrice. Actually, I don't know if thrice is a real word. But anyway, thrice sounds nice. And I'll get a lathe object, drop the spline in the lathe, and I've created a funnel. An excellent looking funnel. Great, I'll name it as such, funnel. Fold it up, click here and I want to copy it.
Go to my previous scene and paste it. Excellent, I will use my skill tool to scale it down, move it across and up. And I'm going to zoom in to place it accurately. I think I can get away with a slightly smaller funnel. Lovely. I will rotate it because as you remember the marble is going to come from this direction.
Good. It's good to observe your scene from all angles because it will help you see if there are any issues, and the faster you catch these issues, the easier the troubleshooting of the scene will be. Good, I'm happy with this. The next thing will be to create the hoops, and I'll use just simple torosi or tori. As you can see, I'm a fan of investigating the English language or destroying it, for that matter. I'll make it smaller, make it thinner.
And sometimes, because I'm too lazy to start moving things around, what I like doing is I select the tores. Drop it in the funnel, as a child of the funnel. And if I zero out these coordinates, press enter and then bring it out again, you will see it is placed where the funnel is, and now it's very easy. I'll just move it across and change the orientation. And bring it up. Sometimes this is one of my favorite techniques but only sometimes. I'll make it a bit smaller, bring it up.
I can adjust positions and so forth as we're preparing the, the whole scene, so. I'm not going to fuss about it too much. I will name this Hoop 1, and I will Cmd+Drag, or Ctrl+Drag on the PC, in my object manager and create the second hoop. Double-click, changes to Hoop 2 and, of course, move it across. Or I can copy it by Cmd or Ctrl+dragging in the view port. I'll name this, Hoop 3. This is lovely; I have three hoops.
Let me create our marble. Marble, now I can always let the name be sphere, but marble has a different kind of appeal to it. And again, because I'm too lazy to move things around and go to top views and side views, I will make the marble a child of Hoop 3. Zero out the object coordinates. Press enter. Lovely. I'll make it as small as I want. Either by pulling the orange handle here or by changing the radius.
I'll make it nice and, and small. Pull it out, and let it sit there for the time being. But the other thing I noticed is that the, these, torosi. These tores, they will be too dense. I will actually move this out of the hierarchy, select the three tores and lower the pipe segments. Although there is no urgent reason to do that, I just like to keep my view port as clean as possible. If I need to increase the number of segments before render time, I can do that, but for now, I'll keep it nice and clear.
Okay, so most of the things are ready. The final thing I want to do is create the domino setup. So, again, I will start with a cube and make it small enough to resemble a domino. I'll leave it as is now and just leaving it right there in the middle, because when I create my low graph cloner and basically make the domino. A child of the cloner. Let's see what's happening here. You can see that the dominoes are stacking on top of each other. And the second thing you can observe is that the slide is right in our face.
So, what I can do I can copy this or cut it, even better. Go to a new scene and paste it. Great. So now, we have a nice clean view port to work on our dominoes. Number one, I want the dominoes to go that way. And if I check the cloner attributes of the actual step size, it's on the Y axes, that's why they're going upwards. I will zero this out, and remember blue is Z, which means if I change this value, they will go thatta way.
I'll make it a bit thinner. And I think it has to be a bit narrower. Yup, looks like a domino. I will change the value here and increase the number of dominoes. I can do that in my main scene. I'll call this Dominoes All. And again, I can go and cut it. Go to my main scene, oh, the funnel, this is not my main scene; this is my main scene, and I can paste it. The next thing to do is raise it above the ground. And there are quite a few ways to do that.
The best is go to the side view, zoom in and make sure it's close to the ground. Then go to our 3D view, and move this on this side and move it back. I can even move it further back. I'm pretty sure the sphere will strike the first domino. Let the first domino strike. Okay, and I'll increase the number. The good thing with this kind of set up is that, at any point, you can change the number of clones.
Good. So, let's rewind and play. And, of course, nothing will happen because we haven't set any key frames or any dynamics, for that matter. I will select all objects, and I will right-click. Go to the simulations tag and add rigid bodies. And of course, when I press play, everything will be demolished. Everything. Becomes a heap of rubbish. So there are a few things we need to take care of.
At this point, I'll make a small diversion. This is a very gray scene if you know what I mean. And I want to do a few things just to make it a bit more clear. Number one, the floor object is all nice and good. But do you actually need a physical object to be visible? Let me turn off the visibility in the editor. Good. Looks nice and clean. Number two, I'm going to create a number of materials. So that we can have different colors for each element, and we'll make it a bit more let's say, happy.
So I'll double-click here, or I'll go create new material; I'll just put numbers; I'll call this one, click here, go to the color and make this pink. Then I will Cmd+click, or Ctrl+click on the PC. Drag it in here and make a copy. And make this, yellow. Cmd+drag, green, Cmd+drag, light blue, Cmd+drag, dark blue, Cmd+drag magenta, and Cmd+drag.
I don't know, I think I've run out of colors. I'll just delete this one. And let's apply colors to each and every object. So dominoes will be red. The hoop, I'll make all hoops yellow. I'll make the marble blue. I'll make the funnel green. I'll make the slide magenta, and you know something, I'm going to make the floor dark blue, so if we turn it on, we'll have a nice blue floor. I'll turn it off for now. Everything seems nice and dandy, but we need to make this simulation work, don't forget about that.
Now, mind you, the fact that the floor is invisible in the editor, does not mean that it doesn't participate in the simulation. If I zoom out here, you will see that the things aren't bouncing off the floor. So visibilities do not affect the actual participation in a dynamic simulation. Let's begin. The first thing I want to do is propel my sphere that way. Now I always like to have one of the arrows pointing towards that direction and for now I'm going to choose the green arrow, which is the Y-axis.
We're going to rotate this, so that, that little green line, which is my Y-axis, points somewhat, you know, if I aim this way, I can see that it's pointing towards the funnel. Good. The second thing I need to do is tell the marble via the dynamics tag; I'm going to the dynamics tab, to have a custom initial velocity. Now, the custom initial velocity has to be applied to the green, green is Y; Y is second.
I know, it's a bit confusing, but you can always remember X, Y, Z, RGB. So G is Y, and so forth. Anyway, sometimes you can do by trial and error. Change these numbers until it works. I will put 500 centimeters per second there. I will rewind and press play. Now, the ball moves, and everything else just falls to the ground. Let's fix a few things. Number one. The hoops, the funnel, and the slide are basically static objects.
So, they participate in the dynamic simulation, but they do not fall. Let me select the dynamics tags of the hoops, the funnel, and the slide. And the way I'm doing this, is by pressing the Cmd key on the Mac. And clicking or the Ctrl key on the PC. If I press this and press Shift and press this, isolate everything, whereas if I use a Cmd or Ctrl key, I can select one.
Now, I am going to press Cmd, select the other, and with the Cmd key pressed, I am going to select this one, this one and this one. When I want to change a common parameter of many tags, I can actually do that. So I selected all the tags. I'm going to the dynamics tab and changing the dynamic's state to off. I'll rewind, press play, and you will see that two things are happening. First of all, the marble hits a, brick wall, should I say? Literally, it hits a wall, and number two, the actual dominoes fly away.
Now, there's, there's good reason for all that. And remember when I said, in one of the previous lessons that by default, the shape of the dynamic objects does not calculate wholes or cavities. Well, all three of these groups of objects, three hoops, the funnel and the slide have one of those two things. The hoops have holes. So, if I select the three hoops and go to the collision tab, I need to go to the shape and change this to static mesh.
Now the holes will be calculated, so the ball will go through the hoops. I have to do exactly the same thing for the funnel. Go to the shape and change it to static mesh. Now the ball will go through the funnel, even though it's stuck, because the funnel is too small. But that's a different problem. I'll select the marble and make it smaller; I'll make it eight. Rewind, press play. Whoa! That's weird. It bounced off. Hm. Why would it bounce off? Well, as with the previous objects, the slide itself is set to automatic, and if I want to show you exactly the shape of the slide, it's going to be an interesting one, project settings > dynamic step > visualization, turn this on, and advance by one.
Turn off all these. Look at this shape here. Because this slide is a very complex shape, the automatic just tries to dress it up as one convex object. And you can see that one of the things it does is intersect with one of the dominoes. That's why the dominoes fly away. Because there's an intersection here, and as I told you because when there's an intersection, the two objects mutually repel themselves. But because a slide is a static object, the only object that gets repelled is the dominoes.
Good. So, by changing the slide to a static mesh, we solve both problems, the problem of the dominoes, as you can see the dominoes are not moving and the problem of the sphere. Let me turn off my visualization, rewind, press play, and you will see that the simulation works quite spectacularly, only we seem to have too few frames. I'll increase this to 600, expand the frame range, rewind, and you can see the marble going down the slide.
All the way around, coming down, coming down, coming down. And, oh, it hits the dominoes, but they don't fall, and that is because we have one more thing to do. We have to select the rigid body tag of the dominoes and set the inherit tag to apply tag to children and the individual elements to all. Because otherwise the whole block of dominoes will be considered one unique dynamic object.
So now I think, I think I can get away with a marble slightly bigger. Rewind. Press play. Click here, so the axis disappears. The marble goes around, and it goes around again and keeps going around. Yay, that was an opposite domino drop, but our crazy machine worked. Well, congratulations, you have built and troubleshooted. Or is it troubleshot? Either way, you have managed to build successfully your first complex dynamic simulation, but there's still much to do.
This course was created by Thanassis Pozantzis. We're honored to host this training in our library.
- Making objects fall with gravity
- Creating dynamic hierarchies
- Controlling the collision shape
- Adjusting properties like Bounce and Density
- Adding keyframed elements to a simulation
- Adjusting the dynamic simulation