Divooka Reference

Scene

23 nodes

On this page 23

Add Body

Function

The scene with a body added. Names must be unique within a scene.

Signature
AddBody -> Scene Description
    scene: Scene Description
    body: Body Description
SceneDescription AddBody(
    SceneDescription scene,
    BodyDescription body)

Parameters

nametypedefaultdescription
sceneScene Description—
bodyBody Description—

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Cloth

Function

The scene with a rectangular cloth, lying flat (in the XY plane) at Center; it falls and drapes unless pinned.

Signature
AddCloth -> Scene Description
    scene: Scene Description
    name: Text
    center: Vector3d
    sizeX: Number
    sizeY: Number
    cells: Integer
    density: Number
    bendingStiffness: Number
    friction: Number
    pin: Cloth Pin
SceneDescription AddCloth(
    SceneDescription scene,
    string name,
    Vector3d center,
    double sizeX = 1,
    double sizeY = 1,
    int cells = 32,
    double density = 0.2,
    double bendingStiffness = 1E-05,
    double friction = 0.4,
    ClothPin pin = ClothPin.None)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
nameText—The cloth's name.
centerVector3d—Centre of the sheet (m).
sizeXNumber1Extent along X (m).
sizeYNumber1Extent along Y (m).
cellsInteger32Cells along the longer side; the shorter side gets as many as keep them square.
densityNumber0.2Areal density (kg/m²): 0.1 to 0.3 for light fabrics, 0.5 and more for canvas.
bendingStiffnessNumber1E-05Bending stiffness (N·m): 1e-5 drapes like cotton, 1e-3 like card.
frictionNumber0.4Friction coefficient.
pinCloth PinNoneWhich vertices are held in place.

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Cloth Mesh

Function

The scene with a cloth made from a Divooka mesh, as it is placed in the world (a garment, a flag, a tablecloth).

Signature
AddClothMesh -> Scene Description
    scene: Scene Description
    name: Text
    mesh: Streamed Vertex Mesh Data
    unitScale: Number
    density: Number
    bendingStiffness: Number
    friction: Number
    pin: Cloth Pin
SceneDescription AddClothMesh(
    SceneDescription scene,
    string name,
    StreamedVertexMeshData mesh,
    double unitScale = 1,
    double density = 0.2,
    double bendingStiffness = 1E-05,
    double friction = 0.4,
    ClothPin pin = ClothPin.None)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
nameText—The cloth's name.
meshStreamed Vertex Mesh Data—The cloth's surface, in Divooka's axes; polygons are split into triangles.
unitScaleNumber1Metres per mesh unit: 1 for metres, 0.001 for millimetres.
densityNumber0.2Areal density (kg/m²).
bendingStiffnessNumber1E-05Bending stiffness (N·m).
frictionNumber0.4Friction coefficient.
pinCloth PinNoneWhich vertices are held in place, judged on the mesh's bounds.

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Garment

Function

The scene with a garment made in Methodox Cloth Designer, as the designer draped it, and the body it was draped on.

Signature
AddGarment -> Scene Description
    scene: Scene Description
    name: Text
    path: Text
    position: Vector3d
    turn: Number
    withBody: Truth
    weldSeams: Truth
SceneDescription AddGarment(
    SceneDescription scene,
    string name,
    string path,
    Vector3d position,
    double turn = 0,
    bool withBody = true,
    bool weldSeams = true)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
nameText—The garment's name; its pieces are named after it.
pathText—The .mgarment file an export from Methodox Cloth Designer wrote.
positionVector3d—Where the floor point under the wearer goes (m).
turnNumber0How far the wearer is turned about the vertical, in degrees, anticlockwise seen from above.
withBodyTruthTrueAdd the body the garment was draped on, when the file has it. Without one the garment falls.
weldSeamsTruthTrueWeld the stitches that start shut, so that their seams hold at one point; off, every stitch is sewn and a seam under load keeps a gap of a millimetre or so.

Returns

resultScene Description

Remarks

Each pattern piece becomes a cloth named garment/piece (tee/front, tee/sleeve.l), woven, with the stiffness of its fabric along the warp and the weft, cut to its flat pattern and starting where the designer's drape left it; the seams become stitches between them, welded where the drape left them shut (every seam the designer welded) and sewn where it left them open (a gathered seam's). The body becomes a static mesh body named garment/body. From there the garment is cloth like any other in the scene: wind blows it, bodies thrown at it move it, and ContinuumResults.GarmentMesh reads it back as one surface. The garment file's frame has y up and the wearer facing +z, which arrives here standing on Z and facing +X.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Tiled Slab

Function

The scene with a slab of ground laid as breakable tiles, named name#1, name#2 …, lying with their tops at Center's height: ground that a blow or a blast cracks and throws. Conditions and actions naming Name match every tile.

Signature
AddTiledSlab -> Scene Description
    scene: Scene Description
    name: Text
    center: Vector3d
    sizeX: Number
    sizeY: Number
    thickness: Number
    tilesX: Integer
    tilesY: Integer
    density: Number
    breakImpulse: Number
SceneDescription AddTiledSlab(
    SceneDescription scene,
    string name,
    Vector3d center,
    double sizeX,
    double sizeY,
    double thickness,
    int tilesX = 6,
    int tilesY = 6,
    double density = 2500,
    double breakImpulse = 500)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
nameText—The slab's name.
centerVector3d—Centre of the slab's top face (m).
sizeXNumber—Extent along X (m).
sizeYNumber—Extent along Y (m).
thicknessNumber—Thickness (m).
tilesXInteger6Tiles along X.
tilesYInteger6Tiles along Y.
densityNumber2500Density (kg/m³): stone 2500.
breakImpulseNumber500Impulse (N·s) that shatters a tile; zero for tiles that are thrown but never break.

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Trigger

Function

The scene with a trigger added; triggers are evaluated after every coupling step in the order they were added.

Signature
AddTrigger -> Scene Description
    scene: Scene Description
    trigger: Trigger Description
SceneDescription AddTrigger(
    SceneDescription scene,
    TriggerDescription trigger)

Parameters

nametypedefaultdescription
sceneScene Description—
triggerTrigger Description—

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Water

Function

The scene with SPH water in a tank, filling a region of it at the start. The tank's walls and floor hold the water only: bodies do not collide with them, so put a ground or walls of static bodies where bodies need them.

Signature
AddWater -> Scene Description
    scene: Scene Description
    name: Text
    tankMin: Vector3d
    tankMax: Vector3d
    fillMin: Vector3d
    fillMax: Vector3d
    particleRadius: Number
    viscosity: Number
SceneDescription AddWater(
    SceneDescription scene,
    string name,
    Vector3d tankMin,
    Vector3d tankMax,
    Vector3d fillMin,
    Vector3d fillMax,
    double particleRadius = 0.01,
    double viscosity = 1E-06)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
nameText—The water's name.
tankMinVector3d—Lower corner of the tank (m).
tankMaxVector3d—Upper corner of the tank (m); its top is open.
fillMinVector3d—Lower corner of the water at the start (m).
fillMaxVector3d—Upper corner of the water at the start (m).
particleRadiusNumber0.01Particle radius (m); bodies need a few particles across their thinnest side. Halving it costs about sixteen times more.
viscosityNumber1E-06Kinematic viscosity (m²/s); water is 1e-6.

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Add Water Tank

Function

The scene with a tank filled with SPH water to a depth.

Signature
AddWaterTank -> Scene Description
    scene: Scene Description
    name: Text
    tankMin: Vector3d
    tankMax: Vector3d
    depth: Number
    particleRadius: Number
SceneDescription AddWaterTank(
    SceneDescription scene,
    string name,
    Vector3d tankMin,
    Vector3d tankMax,
    double depth,
    double particleRadius = 0.01)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
nameText—The water's name.
tankMinVector3d—Lower corner of the tank (m); the water starts at its floor.
tankMaxVector3d—Upper corner of the tank (m).
depthNumber—Depth of the water (m).
particleRadiusNumber0.01Particle radius (m).

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Box

Function

A box.

Signature
Box -> Body Description
    name: Text
    size: Vector3d
    position: Vector3d
    motion: Body Motion
    density: Number
    friction: Number
    restitution: Number
BodyDescription Box(
    string name,
    Vector3d size,
    Vector3d position,
    BodyMotion motion = BodyMotion.Dynamic,
    double density = 1000,
    double friction = 0.6,
    double restitution = 0.1)

Parameters

nametypedefaultdescription
nameText—The body's name.
sizeVector3d—Full size along X, Y and Z (m).
positionVector3d—Centre (m).
motionBody MotionDynamicStatic, dynamic or kinematic.
densityNumber1000Density (kg/m³): wood 600, water 1000, concrete 2400, steel 7850.
frictionNumber0.6Friction coefficient.
restitutionNumber0.1Bounciness, 0 to 1.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Breakable

Function

The body made breakable: a blow (the impulse through one contact during an impact) or a blast whose impulse on it reaches Impulse shatters it into Voronoi fragments, which fly on with its motion.

Signature
Breakable -> Body Description
    body: Body Description
    impulse: Number
    pieces: Integer
BodyDescription Breakable(
    BodyDescription body,
    double impulse,
    int pieces = 8)

Parameters

nametypedefaultdescription
bodyBody Description—A dynamic body (box, cylinder, capsule, sphere or convex mesh).
impulseNumber—Breaking impulse (N·s): a few hundred for brittle stone a hammer can crack, thousands for a concrete column.
piecesInteger8Fragments it shatters into.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Capsule

Function

An upright capsule (its axis along Z): a cylinder with hemispherical ends.

Signature
Capsule -> Body Description
    name: Text
    radius: Number
    length: Number
    position: Vector3d
    motion: Body Motion
    density: Number
    friction: Number
    restitution: Number
BodyDescription Capsule(
    string name,
    double radius,
    double length,
    Vector3d position,
    BodyMotion motion = BodyMotion.Dynamic,
    double density = 1000,
    double friction = 0.6,
    double restitution = 0.1)

Parameters

nametypedefaultdescription
nameText—The body's name.
radiusNumber—Radius (m).
lengthNumber—Total length, ends included (m); at least twice the radius.
positionVector3d—Centre (m).
motionBody MotionDynamicStatic, dynamic or kinematic.
densityNumber1000Density (kg/m³).
frictionNumber0.6Friction coefficient.
restitutionNumber0.1Bounciness, 0 to 1.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Coloured

Function

The body drawn in a colour: the 3D view, and the moments and runs it draws, show it so. An alpha below 255 lets what stands behind it show through - glass at about 60, a tinted pane at 120. Copies a trigger spawns and the fragments it breaks into are drawn in it too. A body given no colour is drawn in its kind's: see-through glass for a static body, steel for a kinematic one, and one of a few soft colours, in turn, for a moving one.

Signature
Coloured -> Body Description
    body: Body Description
    colour: Color
BodyDescription Coloured(
    BodyDescription body,
    ColorElement colour)

Parameters

nametypedefaultdescription
bodyBody Description—The body.
colourColor—Its colour; the alpha is how much of what is behind it it hides.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Cylinder

Function

An upright cylinder (its axis along Z); turn it with Rotated or Rotated About.

Signature
Cylinder -> Body Description
    name: Text
    radius: Number
    length: Number
    position: Vector3d
    motion: Body Motion
    density: Number
    friction: Number
    restitution: Number
BodyDescription Cylinder(
    string name,
    double radius,
    double length,
    Vector3d position,
    BodyMotion motion = BodyMotion.Dynamic,
    double density = 1000,
    double friction = 0.6,
    double restitution = 0.1)

Parameters

nametypedefaultdescription
nameText—The body's name.
radiusNumber—Radius (m).
lengthNumber—Length along its axis (m).
positionVector3d—Centre (m).
motionBody MotionDynamicStatic, dynamic or kinematic.
densityNumber1000Density (kg/m³).
frictionNumber0.6Friction coefficient.
restitutionNumber0.1Bounciness, 0 to 1.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Garment Pieces

Function

The names of a garment's pieces in a scene, as cloths: tee/front, tee/back and so on.

Signature
GarmentPieces -> Text Array
    scene: Scene Description
    garment: Text
string[] GarmentPieces(SceneDescription scene, string garment)

Parameters

nametypedefaultdescription
sceneScene Description—
garmentText—

Returns

resultText Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Ground

Function

An infinite ground plane at a height, solid below.

Signature
Ground -> Body Description
    name: Text
    height: Number
    friction: Number
BodyDescription Ground(
    string name = "ground",
    double height = 0,
    double friction = 0.6)

Parameters

nametypedefaultdescription
nameTextgroundThe body's name.
heightNumber0Height of the plane (m).
frictionNumber0.6Friction coefficient.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Launched

Function

The body with an initial velocity (m/s).

Signature
Launched -> Body Description
    body: Body Description
    velocity: Vector3d
BodyDescription Launched(
    BodyDescription body,
    Vector3d velocity)

Parameters

nametypedefaultdescription
bodyBody Description—
velocityVector3d—

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Mesh Body

Function

A body from a Divooka mesh: static meshes collide exactly (terrain, a car body in a tunnel, a ship's hull as an obstacle); moving ones collide as the mesh's convex hull. The mesh is placed with its own origin at Position.

Signature
MeshBody -> Body Description
    name: Text
    mesh: Streamed Vertex Mesh Data
    position: Vector3d
    motion: Body Motion
    unitScale: Number
    density: Number
    friction: Number
    restitution: Number
BodyDescription MeshBody(
    string name,
    StreamedVertexMeshData mesh,
    Vector3d position,
    BodyMotion motion = BodyMotion.Static,
    double unitScale = 1,
    double density = 1000,
    double friction = 0.6,
    double restitution = 0.1)

Parameters

nametypedefaultdescription
nameText—The body's name.
meshStreamed Vertex Mesh Data—The mesh, in Divooka's axes; polygons are split into triangles.
positionVector3d—Where the mesh's origin goes (m).
motionBody MotionStaticStatic (exact triangles), dynamic or kinematic (convex hull).
unitScaleNumber1Metres per mesh unit: 1 for metres, 0.001 for millimetres.
densityNumber1000Density (kg/m³), for moving bodies.
frictionNumber0.6Friction coefficient.
restitutionNumber0.1Bounciness, 0 to 1.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

New Scene

Function

An empty scene: Earth gravity along -Z and the default solver rates.

Signature
NewScene -> Scene Description
    gravity: Number
    couplingRate: Number
    clothSubsteps: Integer
    seed: Integer
SceneDescription NewScene(
    double gravity = 9.81,
    double couplingRate = 120,
    int clothSubsteps = 15,
    int seed = 1)

Parameters

nametypedefaultdescription
gravityNumber9.81Gravitational acceleration (m/s²), pointing down along -Z.
couplingRateNumber120How many times per second the solvers exchange forces (Hz): 120 for rigid bodies and cloth, 200 to 480 when light bodies float in water.
clothSubstepsInteger15Constraint sub-steps of the cloth solver per coupling step: 10 for soft cloth, 15 to 20 for hanging or loaded cloth.
seedInteger1Seed of the random numbers triggers scatter spawned bodies with.

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Rotated

Function

The body turned by a rotation about its centre.

Signature
Rotated -> Body Description
    body: Body Description
    rotation: Quaterniond
BodyDescription Rotated(
    BodyDescription body,
    Quaterniond rotation)

Parameters

nametypedefaultdescription
bodyBody Description—
rotationQuaterniond—

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Rotated About

Function

The body turned about an axis by an angle in degrees.

Signature
RotatedAbout -> Body Description
    body: Body Description
    axis: Vector3d
    degrees: Number
BodyDescription RotatedAbout(
    BodyDescription body,
    Vector3d axis,
    double degrees)

Parameters

nametypedefaultdescription
bodyBody Description—
axisVector3d—
degreesNumber—

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Set Gravity

Function

The scene with a gravity vector of any direction (m/s²).

Signature
SetGravity -> Scene Description
    scene: Scene Description
    gravity: Vector3d
SceneDescription SetGravity(
    SceneDescription scene,
    Vector3d gravity)

Parameters

nametypedefaultdescription
sceneScene Description—
gravityVector3d—

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Set Wind

Function

The scene with a steady wind that pushes cloth, bodies and water, with optional gusts.

Signature
SetWind -> Scene Description
    scene: Scene Description
    velocity: Vector3d
    gusts: Number
SceneDescription SetWind(
    SceneDescription scene,
    Vector3d velocity,
    double gusts = 0)

Parameters

nametypedefaultdescription
sceneScene Description—The scene.
velocityVector3d—Wind velocity (m/s).
gustsNumber0Gust amplitude (m/s).

Returns

resultScene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation

Sphere

Function

A sphere.

Signature
Sphere -> Body Description
    name: Text
    radius: Number
    position: Vector3d
    motion: Body Motion
    density: Number
    friction: Number
    restitution: Number
BodyDescription Sphere(
    string name,
    double radius,
    Vector3d position,
    BodyMotion motion = BodyMotion.Dynamic,
    double density = 1000,
    double friction = 0.6,
    double restitution = 0.1)

Parameters

nametypedefaultdescription
nameText—The body's name.
radiusNumber—Radius (m).
positionVector3d—Centre (m).
motionBody MotionDynamicStatic, dynamic or kinematic.
densityNumber1000Density (kg/m³).
frictionNumber0.6Friction coefficient.
restitutionNumber0.1Bounciness, 0 to 1.

Returns

resultBody Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Scene
Package
Physics Simulation