Here is an outline of the basic steps for building a rigid body simulation using the Bullet Physics nodes in MCG.


A Bullet Physics system is known as a "world". The world is what needs to be cached and updated during the simulation, and it should contain all of the rigid bodies that participate in the simulation together with their constraints and relations.
Before you can add rigid bodies to the world, you must create the world itself. It requires an initial time, which is typically the start time of your scene. You can also set the world's gravity.

Dynamic objects are rigid bodies whose transforms get updated by the Bullet Physics engine, as opposed to other objects that serve only as potential collision objects.
Adding a dynamic object to the world involves the following basic steps:
Set up the rigid body's dynamic properties.
For a dynamic object, the mass must be a positive, non-zero value.
Add the dynamic object to the world.
Later you will need a dynamic object's index to get its transform value back from the world, so keep track of the number of dynamic objects added to the world and their order. The first object added to the world has index 0, the second has index 1, and so on.

The Bullet Physics engine uses collision objects for collisions of dynamic objects, but it will not update their transforms. They are typically used for things like floors and walls, but can also be animated.
Adding collision objects is similar to adding dynamic objects, but simpler:
Again, you can use arrays to add multiple collision objects.

After you have added the last rigid body, use the resulting function to set the initial state of the world's cache.
Now, you need to define how to update the cache on each frame. There may be two steps to this:

Updating the transforms of the collision objects involves getting their current transform matrices from the INodes in the scene, and setting the transforms of the corresponding rigid bodies in the world by index. As before, you can use arrays for multiple objects.

Step the simulation forward, based on the difference between the scene's current time and the last simulation time. Connect the resulting function to the updateFunc port of the CreateCache node.

The last step is to get the simulated transform values from the cached world by index, and use them somehow.