Cinema 4D / BodyPaint 3D Program Documentation Tutorials MoGraph Tutorial
Function available in CINEMA 4D Broadcast, Studio

Collisions with MoDynamics

In the course of the previous tutorials you have not only learned basic MoGraph functions but have also used several new MoGraph 2 functions. MoDynamics is also new to MoGraph 2. With MoDynamics lets you create fantastic dynamic effects using collision and forces - and have fun doing so. We will begin with a classic example: a tower made up of wooden blocks that is made to fall when a steel ball crashes into it.

Click on the following link to open the Cinema 4D file with which to start the tutorial:


Our start file contains three differently colored wooden blocks and a steel ball. This ball will later be used to topple the tower. First we will build the tower using MoGraph.

Building the tower using Cloner objects and Effectors

First we will create a single row by creating a Cloner from the MoGraph menu and making all three blocks Child objects of this Cloner object. Rename the Cloner object "Row".

Set the Cloner object’s Mode to Grid Array, which will position the three blocks next to each other while keeping the Cloner object’s origin centered. We want the clones to repeat in each row. Since we have 3 Clones, set the X, Y and Z Size values to 150, 0 and 0, respectively. With a block width of 70 this will result in a space between the rows equal to a value of 5. Set the Cloner object’s Y Position value to 17.5 so it lies correctly on the floor.

We will now add an Effector that will rotate the clones very slightly to make the arrangement of the blocks look less artificial and "planned".

Create a Random from the MoGraph menu and rename it "Random Effector Row". Later we will add another Effector that we will use to stack the blocks. In the Parameter tab, disable the Effector’s Position option and enable its Rotation option. Set its Heading rotation to a very low value of . This will ensure the blocks don’t rotate too far and intersect.

Switch to the "Row" Cloner object’s Effectors tab and drag the Random Effector into the Effectors field.

As the image below shows, the blocks have been slightly rotated but don’t intersect. Now that this row of blocks is finished we can use the Cloner object to duplicate row after row of blocks until we have our finished tower.

To do so we will use a new Cloner object and rename it "Tower". This time we will duplicate our blocks linearly until we have a total of 15 rows. Since all blocks have a height of 35 we will set the Effector’s Mode to Per Step with a Y Offset (P.Y) of 35. We also want every other row to be rotated by 90° so set the Heading value accordingly. Make sure the "Row" Cloner object’s Y position was assumed correctly and check to see if each row of blocks differs slightly from the other for a more realistic look.

Create a new Random Effector or duplicate the existing one (Ctrl/Cmd+click+drag in the Object Manager) and rename it "Random Effector Tower". This Effector will only affect the rows of blocks of the tower. In its Parameter tab, disable the Position option and enable the Rotation option. Set the Heading rotation value to .

In order to make the new Effector affect the clones of the "Tower" Cloner object, drag it into the Cloner object’s Effectors field (Effectors tab).

The rendering below shows our finished tower - which will now be made to topple by the steel ball …

Defining MoDynamics Elements

The sphere is already present in the scene. It has a Radius of 40, which will have to be taken into account for its starting position. In order for MoDynamics to recognize this sphere as a collision object we must first make it a Child object of a Cloner object. First, create a new Cloner object, rename it "Starter", and then make the sphere a Child of this object.

Since we only need a single clone, i.e., the existing sphere, lower the Count value to 1. Set a start position for X of 1000 and 40 Y. The value for Y is based on the sphere’s radius. Otherwise, no other parameters for the Cloner object need to be modified.

To add dynamic motion to the elements effected by MoDynamics, a Rigid Body tag must be added. This tag can be found in the Object Manager’s menu under Tags | Simulation Tags.

We will first assign a Rigid Body tag to the Floor object onto which the blocks will fall. Increase the value to 100% and reduce the Collision Noise value to 0% so the blocks quickly come to rest and don’t slide across the floor.

Also assign a Rigid Body tag to the "Row" Cloner object, which will ensure that each individual block will be affected by the dynamic forces. If you own Cinema 4D Broadcast you will have a greater number of options available to you. This is because Dynamics in Cinema 4D Broadcast only works with MoGraph objects. All other objects to which this tag is assigned only serve as collision objects in other Cinema 4D packages. Since the object to which we assigned this tag is a Cloner object several additional parameters are made available. Because the blocks lie on top of each other and should not move until hit by the ball, set the parameter to On Collision. Enable collision for All Individual Elements and enter the values for Bounce, Friction and Collision Noise as shown in the image below. We do not want the blocks to have too little friction when they interact. One of the most important parameters is the Mass of the blocks. We will define a custom mass so the tower and the ball can interact correctly to create a very dynamic animation.

We now need a Rigid Body tag for our "Starter" object. After assigning the tag switch to the tag’s Attribute Manager settings. We want the sphere to begin rolling at the start of our animation so we will set the Trigger option to Immediately. To quickly get the sphere up to speed, set its Initial Linear Velocity to -2000, which will make the sphere shoot towards the tower. Set the Bounce, Friction and Collision Noise values as shown in the image above. Since the sphere is made of steel is will have a very low Friction value and little Bounce. Next we will turn our attention to the sphere’s most important collision parameter: Mass. Here we will also define a custom and will set it much higher than that of the tower - 100.

Before you press the Play button to bring this tower crashing down, make sure the Gravity option is enabled in the Project Settings (Edit menu) menu. The default value is 1000.

Now we can start making detailed corrections. If you take a look at the result frame-for-frame you will quickly see that the clones intersect (this is not noticeable when the fast-moving animation is viewed at normal speed but can be bothersome if the animation is, for example, viewed in slow motion). This is caused by the fact that the objects move so quickly - in the first frame they are lying next to each other and in the second frame their positions already intersect. The Project Settings’ Steps per Frame parameter (Dynamics tab / Expert) can be used to define how often collisions should take place between 2 frames. The intersections can be reduced but the objects will repel even more, which means other values such as mass, initial velocity, friction, etc. will also have to be adjusted accordingly. If you experiment with this parameter you will see how great an effect it can have on your animations.

Click on the following link to see a rendered movie of this MoDynamics animation:

 

Click here to open the finished Cinema 4D file: