Quicktip - Dynamics Collision Margin

Firstly, Happy Hollween 2013!

In Cinema 4D (R13 in this case) you may run into a problem where you've created some objects added a Rigid Body or Collider Tag to, and though they collide, they do not touch. As you'll see in the following example video, as well as a way to correct this problem.


Below is the Dynamcs Expert tab which you'll find in the Projects Settings. 
Mode>Project Info>Dynamics>Expert:
.

To gain a further understanding about the Dynamics Experts tab, the Collison Margin and what all those settings do lets read what Maxon has to say first hand

Expert
Collision Margin [0..+∞m]

This value generally does not have to be modified. It only affects certain collision types. CINEMA 4D has several internal, optimized collision algorithms: 
  • Box/Box (two Cube primitives in a Rigid Body tag with a Box Shape. 
  • Sphere/Sphere (two Sphere primitives in a Rigid Body tag with a Ellipsoid Shape. 
  • Convex/infinitely large plane (i.e. a Floor Object). 
  • Convex/convex 
  • Convex/concave

The Collision Margin parameter only affects the last two collision types.
A brief explanation of convex and concave: 
  • Convex: the rubber skin mode (see also s.a. Shape Convex Hull Shape) 
  • Concave: real polygon mesh (see also Shape Static Mesh Shape) as long as it can’t be associated with a simplified type based on its shape (which is the case with many Primitives).

Simply said, Collision Margin works as follows: If using a Cube, for example, the margin will be subtracted from the cube, which will produce a smaller cube and added again, which in turn will produce a cube with rounded edges that is as large as the original cube.

Sharp edges will be rounded.

This value should only be modified if the collisions appear to be unstable or incorrect. The value can also be set to 0, which will reduce both stability and render times.

What about all those other settings?

Scale [0..+∞m]

This is the factor by which the CINEMA 4D units of measure will be reinterpreted in the bullet engine. Simply follow this rule of thumb:

If you have objects flying through your scene that are 100 CINEMA 4D units in size, leave the Scale value set to 100m. If the objects are 1000 units in size set the Scale value to 1000m.

This value only has to be modified if objects start behaving strangely, i.e. if it comes to faulty calculations.

Restitution Lifetime for Resting Contact [0..+∞]

Prevents tiny imperfections in movement from occurring upon collision in accordance with the value defined here. For objects resting on or against each other, tiny elastic bumps - that are not visible - are calculated to prevent the objects from intersecting. After the defined time has elapsed, no tiny elastic bumps at all will take place.

Imagine a Newton pendulum where the sphere initially lie in a state of rest next to each other - if the time span defined here is too short the pendulum would simply not work.

Contrary to the velocity threshold values (Linear Velocity Threshold), the object will otherwise continue to be affected by all other objects.

Random Seed [-2147483647..2147483647] 

When MoGraph Dynamics are calculated, random numbers are used at various locations. Modifying this value will result in different random numbers being generated, which will affect the dynamic objects’ behavior accordingly. Imagine pouring a cluster of Clones into a glass and the position of one of the Clones is not correct. Modify the Random Seed value and play the animation again. The Clones will now lie in different positions each time the Random Seed value is modified.

Steps per Frame [1..1000]

This parameter is crucial for the precision of the MoGraph dynamics simulation. The higher the value, the more precise the calculation will be. This value should be increase in particular when penetration occurs by Clones travelling at high velocity.

So, what exactly what effect does the Substeps parameter have? Well, it subdivides each animation frame in the defined temporal region and calculates the Dynamics for each frame.

We’ll use a cube travelling at high velocity that collides with the floor. Let’s say the cube is just above the floor in frame 12 and completely below the floor in frame 13. CINEMA 4D would not register a collision in this instance (if the Substeps value were set to 1). If the Substep value were increased, a collision could be registered, e.g. at frame 12.2 and 12.4, respectively, and correctly calculated.

Higher values result in greater precision but also in longer render times.

Maximum Solver Iterations per Step [3..10000] 

As described in the previous parameter, each frame of animation will be split up into a number of Substeps. For each of these steps a complex system of equations must be solved iteratively for collision contacts and Connectors. This means that the solution will be approached step-by-step with increasing accuracy. The maximum number of steps can be defined here

Error Threshold [0.1..100%]

The Error Threshold value defines the point at which the interations should be stopped. Large values will result in a less accurate approximation (to the correct result) than smaller values.

To cut a long story short: Normally you will not have to modify these settings. If, however, objects with a large difference in mass collide (one is heavy, one is light) the default values of these parameters should be adjusted to prevent the objects from penetrating each other or the Connector from having an imprecise effect.

Use AVX 

This option will only be made available if your computer’s processor understands this (new) set of "AVX" commands. This currently (as of Q4 2011) only applies to very few processors such as Intel’s Sandy Bridge and Ivy Bridge, and AMD’s Bulldozer. AVX lets collision commands be calculated faster (especially when many objects collide with other objects with Shape Convex Hull) applied. Old Projects will then be loaded with this option disabled so the simulation’s calculation remains unchanged.

Hope this helps you to understand the Dynamics Expert Tab settings functions better.

Comments