Getting Started
This page builds a small scene with the three solvers of the coupled scene: a crate on the ground, a napkin that falls onto it, and a pool of water beside it. It is written for Divooka users; no C# is needed.
Screenshots of the graphs are still to come. Until then, the tables list each node and the values to type into it.
1. Before you start
- Install Divooka Explore (see Installation).
- Continuum's nodes are under the Physics heading of the node library. This page uses six of its categories: Scene, Triggers, Simulation, Results, Export and Simulation Session.
- Keep three conventions in mind:
- Axes: Divooka's, +Z up. Gravity is (0, 0, −9.81).
- Units: SI. Metres, kilograms, seconds; densities in kg/m³; cloth in kg/m².
- Names: every body, cloth and water body has a unique name, and later nodes refer to it by that name.
2. Describe the scene
In a dataflow graph a scene is a value. Each ContinuumScene node takes a scene and returns a new one with something added, so the scene flows along a chain of nodes.
| # | Node | Inputs | What it adds |
|---|---|---|---|
| 1 | NewScene |
couplingRate 200 |
an empty scene; solvers exchange data 200 times a second |
| 2 | Ground |
an infinite ground plane at z = 0, named ground |
|
| 3 | AddBody |
scene from 1, body from 2 | the ground |
| 4 | Box |
name crate, size (0.6, 0.6, 0.6), position (0, 0, 0.3), density 300 |
a dynamic 0.6 m crate standing on the ground |
| 5 | AddBody |
scene from 3, body from 4 | the crate |
| 6 | AddCloth |
name napkin, centre (0, 0, 0.9), size 1 × 1, cells 24 |
a 1 m napkin 0.9 m up, free to fall |
| 7 | AddWaterTank |
name pool, tank min (0.8, 1.0, 0), max (1.6, 1.8, 0.5), depth 0.2, particle radius 0.02 |
a 0.8 m tank of SPH water, 0.2 m deep |
Shapes are made by their own nodes (Box, Sphere, Cylinder, Capsule, MeshBody) and placed with AddBody. Modifiers return a changed copy: Rotated and RotatedAbout turn a body, Launched gives it a starting velocity, and the motion input makes a body Static, Dynamic or Kinematic.
3. Run it
Connect the last scene to Simulate with duration 2 and framesPerSecond 30. Simulate runs the whole scene and returns a SimulationResult with 61 frames (frame 0 is the scene before the first step).
Because the engine is deterministic, Simulate is a pure function: the same scene always gives the same result, bit for bit, whatever the number of threads. Divooka can cache it and will not run it again until something upstream changes.
4. Read the result
| Node | Inputs | Output |
|---|---|---|
FrameCount |
result | 61 |
BodyPosition |
result, crate, frame 60 |
the crate at rest: z = 0.300 m |
ClothMesh |
result, napkin, frame 60 |
the napkin draped over the crate, as a mesh |
WaterSurface |
result, pool, frame 60 |
the pool's surface as a mesh |
WaterParticleCount |
result, pool, frame 60 |
2 000 |
ExportSequence |
result, folder cache |
one OBJ per frame and one PLY per water body per frame |
Meshes come out as Divooka's StreamedVertexMeshData, ready for Divooka's renderers and Divooka.Geometry.IO.
5. The same scene, procedurally
To act while the scene runs (push a body, set off a charge, react to an event), start a session from the same scene description instead of calling Simulate:
SimulationSession.Startwith the scene.- A loop while
Timeis under 2 s:StepFrameat 30 fps, thenTakeEventsand act on what happened. - Read the state with
BodyPosition,ClothMesh,BodiesMeshorWaterParticles, or render a quick CPU preview withSavePreview.
Stepping a session frame by frame gives exactly the frames Simulate records. See Procedural API.
6. Add an event
Triggers make things happen during the run. To set off a small charge under the crate as it falls past 1 m, add a trigger before simulating:
When, with namecharge, conditionBelow("crate", 1)and actionDetonate(offset, 0.2, atEvent: true).AddTriggerputs it into the scene.
The trigger is evaluated by the engine after every coupling step and fires at the step the crate crosses 1 m. See Events and triggers.
7. Common pitfalls
- A charge at a body's own centre does nothing to it. A blast pushes the surfaces that face it; give
Detonatean offset beside the body. - Millimetre meshes. Geometry authored in millimetres needs
unitScale0.001 inMeshBodyandAddClothMesh. - Water in a tank on the ground. Where a ground plane is the tank's floor, the ground holds the water; the package leaves the tank's own floor open so the floor is not counted twice.
- Large results. A result keeps every frame in memory, water at 12 bytes per particle per frame. Pass
recordWater: falsetoSimulatewhen you only need bodies and cloth.
Next
- Architecture explains the coupling step and the conventions in depth.
- The domain pages under Domains describe each solver, what it is good at and its limits.