From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Bullet Integration Proposal

Integration

Note

This design is by Brecht, I only ask him questions and write code :) (Arystan).

Groups

Rigid bodies are organized into groups. This facilitates playback speed and user control. For example, one can 'mute' simulation in one group for faster playback in another group. Grouping also allows to have per-group physics settings and do per-group baking.

TODO: more about per-group physics settings.

Depsgraph

Regular transform evaluation order is slightly re-arranged to allow rigid bodies to remain participating in parent-child and constraint relationships while being driven by physics.

Object transforms are evaluated as follows:

  1. evaluate transform on rigid bodies (according to flags set by DAG)
  2. perform physics simulation step
  3. evaluate transform on all the rest objects

Here's the pseudocode (for scene_update):

for all physics groups:
	if group is 'enabled':

		for all objects in group:
			object_handle_update();

		# simulate physics in this group
		rigidbody_group_step(group, time);

for all objects in scene:
	object_handle_update();

The above is a bad method because it doesn't first update objects that rigid bodies depend on. Brecht suggested the following method:

for all physics groups:
	for all objects in group:
		physics group count++

for all objects in scene:
	object_handle_update(object);

	for all physics groups:
		if object in group:
			physics group count--
			if physics group count == 0:
				rigidbody_group_step(group, time);

Animation and Simulation Blending

Later...

Integration with Soft body, Cloth and Fluid

This is the difficult part that I currently can't cope with. I can tackle this later when I better understand physics sim. internals.

References