Share

Setting up rigid body simulations

To get started with rigid body dynamics, you can start with one of the RBD examples in the Bifrost Browser and adapt it. If none of those are a good starting point, you can start with one of the basic RBD graphs: basic_rigid_body_graph or basic_rigid_body_instance_graph.

  • basic_rigid_body_graph is a good starting point when you have individual "hero" meshes that you want to simulate.
  • basic_rigid_body_instance_graph is a good starting point when you want to simulate multiple copies of the same mesh shapes.

Note that the rigid body solver always operates on instances. You can use both meshes and instances of meshes as inputs for either of these graphs, and they automatically create RBD instances if needed. They can also both be customized as much as desired — the difference is simply a matter of convenience.

Important:

  • Make sure that rigid bodies do not intersect. Intersections can cause extremely strong forces that result in explosive behaviour.
  • Rigid bodies may disappear if the instances' point_size is 0. Be careful when merging instances that point_size exists on all instance objects and is not being set to the default value.

basic_rigid_body_graph

Add a basic_rigid_body_graph node, then right-click on it and select Explode.

`basic_rigid_body_graph`

  1. Connect the meshes that you want to simulate into the geometry port of create_rigid_bodies and set the properties as desired. If you want some meshes to have different properties (for example, to act as kinematic objects or to activate at a different time), then use additional create_rigid_bodies nodes and connect all their outputs to the instances port of simulate_rigid_bodies.

  2. For static colliders like floors and permanent walls, connect meshes to the meshes port of create_static_collider. Use solid meshes like cubes instead of planes. If you want different colliders to have different friction or other properties, use additional create_static_collider nodes and connect all their outputs to the static_collider_instances port of simulate_rigid_bodies.

  3. Use the rigid_body_solver_settings node to adjust general settings like gravity and substepping.

  4. Do the following:

    • Connect forces such as wind or drag and other general influences into the influences port of simulate_rigid_bodies.
    • Connect constraint influences such as constraint_strength_influence into the constraint_influences port.
    • Connect the out_instances output port to an output node at the top level of the graph, or to a terminal node.

basic_rigid_body_instance_graph

Add a basic_rigid_body_instance_graph node, then right-click on it and select Explode.

`basic_rigid_body_instance_graph`

  1. Connect the mesh shapes that you want to instantiate into the geometry port of rigid_body_instance and set the properties as desired. If you want some meshes to have different properties (for example, to act as kinematic objects or to activate at a different time), then use additional rigid_body_instance nodes and connect all their outputs to the instance_geometries port of create_instances.

  2. Connect the points object for the starting positions of the instances into the points port of create_instances, and select how to assign shapes to the point positions.

  3. Set properties as desired on the set_rigid_properties node.

  4. For static colliders like floors and permanent walls, connect meshes to the meshes port of create_static_collider. Use solid meshes like cubes instead of planes. If you want different colliders to have different friction or other properties, use additional create_static_collider nodes and connect all their outputs to the static_collider_instances port of simulate_rigid_bodies.

  5. Use the rigid_body_solver_settings node to adjust general settings like gravity and substepping.

  6. Do the following:

    • Connect forces such as wind or drag and other general influences into the influences port of simulate_rigid_bodies.
    • Connect constraint influences such as constraint_strength_influence into the constraint_influences port.
    • Connect the out_instances output port to an output node at the top level of the graph, or to a terminal node.

Was this information helpful?