The following files contain the implementation of the rigid bodies:
For the parts of code that use the Bullet Physics, search for the
Setting the properties and executing the rigid body simulation are separate operations.
Adding a rigid body simulation to an object in the UI results in call to
rigidbody_object.c) which in turn calls
rigidbody.c). This functions creates the rigid body world by calling
rigidbody.c) in case it doesn't exist and allocates the memory for
rigidbody.c) and assigns default values.
For instance the mass property is displayed in the
PHYSICS_PT_rigid_body_settings panel (
properties_physics_rigidbody.py). It references the RNA property defined in
rna_rigidbody.c which calls
rna_RigidBodyOb_mass_set() when a new value is assigned through the UI. This stores the value in
RigidBodyOb of the object and updates the state of the Bullet Physics through
Adding a rigid body constraint results in a call to
rigidbody_constraint.c). A constraint collection is created if it doesn't already exist. The constraint is created through
rigidbody.c) and added to the constraint collection through
When starting the simulation it executes the function
deg_builder_nodes.cc) which calls
rigidbody.c). It uses the properties for the world, objects and constraints that were previously assigned.
The explanation of the call stack is a simplification of all the operations that happen during configuration and simulation. They are meant as an overview for where certain steps can be found in the code and not a complete explanation of the performed operations.