Fig. 1: Constructing the female fruit fly body model.

a, Compilation of six datasets representing a single fly. Maximum intensity projections of confocal stacks showing head, thorax with abdomen, wings and legs. Scale bar, 1 mm. b, Left, a partial projection of the midleg confocal volume with the joints between the femur, tibia and tarsal segments indicated. Middle, a 3D mesh extracted from the volume. Right, a low-polygon leg model. Scale bar, 0.2 mm. c, An exploded low-polygon fly model (around 20,000 faces) showing all body segments. Scale bar, 1 mm. d, The geometric fly model assembled in Blender. e, The complete physics fly model in MuJoCo simulator in the default rest pose. f, Fly model in a flight pose with retracted legs. g, DoFs. Translucent bottom view with light-blue arrows indicating hinge joint axes pointing in the direction of positive rotation. Groups of three hinge joints effectively form ball joints. Cube: 6-DoF free joint required for free CoM motion in the simulator and is not a part of fly’s internal DoFs. h,i, Side view (h) and bottom view (i) of the geometric primitive (geom) approximation of body segments used for efficient collision detection and physics simulation. Blue, collision detection geoms; purple, geoms that have associated adhesion actuators; orange, wing ellipsoid geoms for simulating flight with the advanced fluid force model. j, Visualization of actuator forces generated when the model fly hangs upside down. The adhesion actuators of the front-right, middle-left and hind-right legs are actively gripping the ceiling (orange); the labrum (mouth) adhesors are also active; other actuators are inactive (white). The arrows visualize net contact forces proportional and opposite to the applied adhesion forces. k, Exaggerated posture showing the coordinated activation of the abdominal abduction and tarsal flexion actuators. Abdominal joints and tarsal joints (yellow) are each coupled with a single tendon actuator that simultaneously actuates multiple DoFs.