Appearance
KOI: driving a skinned fish
Run a prepared fish whose articulated physical skeleton deforms a skinned mesh. The control script applies phase-shifted servo commands and records body/joint motion.
Download koi-gen2.fll and koi_swimming.py into the same tutorial folder. The attachment already contains the physical chain, servo models, Gen 2 FluidBoundary setup and tracked side/top Cameras. It is ready for the script below.

1. Start Flare Live and install the client
Open Flare Live and save existing work. Stop Simulation and end any Experiment before running the script, which opens the downloaded project in that instance.
In a terminal in your tutorial folder, follow Workspace RPC to install the client and activate its environment. For a run without a GUI, start CLI serve in terminal A and run the script in terminal B.
2. Run and keep the result visible
The settings at the top of koi_swimming.py specify duration, normalized amplitude, frequency and phase lag. Run:
sh
python koi_swimming.pyThe script begins an Experiment, disables competing Custom Input, initializes and applies 1 Hz sine commands with a half-second ramp. Expect 2 simulated seconds; 600 steps with the supplied setup.
The script leaves Simulation paused so the final joint and skin poses remain visible. Before rerunning it, choose Simulation > Stop, then End experiment (discard). To return automatically, add ws.clear_simulation() and ws.end_experiment() at the end of the script, inside the connection block.
3. Inspect the outputs
text
koi-output/
├── trajectory.csv
└── export/
└── <run-series>/
└── camera_views/
├── Tutorial side/
└── Tutorial top/The CSV columns are time_s, sensor_path, values. Body rows at head/info use the Body Info layout; the other rows contain the configured Joint Sensor values. Rerunning the script overwrites this CSV and creates a new image-export series.
Compare the initial/final PNGs and inspect the paused GUI: the skeleton and skin should bend together. Plot joint angles to check phase delays. For a propulsion comparison, set AMPLITUDE = 0 for a neutral-command trial, then restore 0.15 for an active trial from the same initial state.
Supplied configuration
| Setting | Value |
|---|---|
| Fluid | Gen 2, density 1000 kg/m³, kinematic viscosity 1e−6 m²/s, initially still. |
| Cell size / maximum velocity | 0.01 m / 3 m/s; step size about 0.003333 s. |
| Wall model | NoSlip. |
| Motion | X/Z translation and rotation around Y; root position limits lock Y and rotations around X/Z. Gravity is zero. |
| Command | Normalized amplitude 0.15, frequency 1 Hz, successive 60° phase lags in the order below. |
| Binding | The prepared file uses matching bone-object names. Newly imported models use explicit Bone Binding children. |
The script lists servo paths explicitly from head to tail:
Servo path below head/ | Model maximum angle (rad) |
|---|---|
spine/servo | 0.13 |
spine/spine01/servo | 0.26 |
spine/spine01/spine02/servo | 0.52 |
spine/spine01/spine02/spine03/servo | 0.52 |
spine/spine01/spine02/spine03/tail_start/servo | 0.17 |
A normalized amplitude of 0.15 multiplies each model's maximum angle. For example, the first joint's commanded amplitude is 0.0195 rad, about 1.12°. The supplied setup isolates planar bending and fluid response; configure gravity/buoyancy and constraints for a free 3D swimming experiment.
Build a new skinned fish
- Import Model, select the Model preset, review axes/units and click Add to scene.
- Replace selected skeleton Empty objects with Joint-Body Pairs: Free root, Revolute bending joints and Fixed rigid links.
- Set each body's mass, center of mass and inertia, and configure the bending axes.
- Add Simple Servo drives, models and Position-mode Joint Sensors.
- Keep the Skinned Mesh Shape beneath a parent whose subtree contains all its bones and Bone Bindings. Confirm the skin follows the driven skeleton.
- Enable FluidBoundary on the skinned shape and Boundary on Gen 2.
See skinning and rigid-body construction for hierarchy requirements.
The supplied FLL's matching bone names already work; it needs no conversion before this tutorial. If renaming those bones, add correctly named Bone Binding markers first.
For an actuator-surface approximation instead, add Actuator Surface to the skinned shape, clear its FluidBoundary role and enable Actuator Surface Coupling. Use one intended surface-force model for that shape.