元编程参考文档

液体

23 个节点

本页内容 23

添加液体中的物体

函数

在水箱里放进一个刚体后的场景,刚体由长方体、球、胶囊等物体节点做出。动态物体按密度浮起或下沉(水是 1000 千克/立方米),被液体带着走、抛起,也反过来推动液体;物体之间、物体与场景的固体、与水箱的底、四壁和盖子(有的话)都会碰撞:盛得住液体的,也盛得住漂在里面的东西。液体把球、长方体和胶囊当作它们本来的形状,把其他形状当作包住它的长方体;比一个单元还薄的物体,液体感觉不到。

签名
添加液体中的物体 -> Liquid Scene Description
    场景: Liquid Scene Description
    物体: Body Description
LiquidSceneDescription AddLiquidBody(
    LiquidSceneDescription scene,
    BodyDescription body)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
物体Body Description—The body. A static one stands where it is, as a solid does; a kinematic one is moved by a session's Move Solid.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加液体长方体

函数

给场景加一个装满液体的长方体,静止或运动。

签名
添加液体长方体 -> Liquid Scene Description
    场景: Liquid Scene Description
    名称: 文本
    位置: Vector3d
    大小: Vector3d
    速度: Vector3d
LiquidSceneDescription AddLiquidBox(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size,
    Vector3d velocity)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
名称文本—The body's name.
位置Vector3d—The box's centre (m).
大小Vector3d—The box's size (m) along X, Y and Z; what lies outside the tank or inside a solid is left out.
速度Vector3d—The velocity it starts with (m/s).

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加排水口

函数

加入一个排水口后的场景:液体在其中消失的一个长方体。嵌在底面上它就是一个放水孔,周围的液体像流进洞里一样流进去;既有水龙头又有排水口的水箱,会找到一个深度,使排走的正好等于注入的。

签名
添加排水口 -> Liquid Scene Description
    场景: Liquid Scene Description
    名称: 文本
    位置: Vector3d
    大小: Vector3d
LiquidSceneDescription AddLiquidDrain(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
名称文本—The drain's name.
位置Vector3d—Its centre (m).
大小Vector3d—Its size (m) along X, Y and Z: two cells deep or more, so that liquid falling fast does not pass through it in a step.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加液体球

函数

给场景加一个液体球,静止或运动:一滴正要落下的水。

签名
添加液体球 -> Liquid Scene Description
    场景: Liquid Scene Description
    名称: 文本
    位置: Vector3d
    半径: 数字
    速度: Vector3d
LiquidSceneDescription AddLiquidSphere(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    double radius,
    Vector3d velocity)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
名称文本—The body's name.
位置Vector3d—The ball's centre (m).
半径数字—The ball's radius (m).
速度Vector3d—The velocity it starts with (m/s).

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加水龙头

函数

加入一个水龙头后的场景:一个圆形喷口,只要开着就往里注入液体,形成一股具有给定速度的水柱。一根水管,瀑布的边沿,水盆上方的龙头。水箱会留出水龙头在它们开着的时间里(从不关闭的按二十秒算)所注入液体的空间;一次运行要的更多时,“液体被拒数”会说出来。

签名
添加水龙头 -> Liquid Scene Description
    场景: Liquid Scene Description
    名称: 文本
    位置: Vector3d
    半径: 数字
    速度: Vector3d
    流量(升/秒): 数字
    开始: 数字
    结束: 数字
LiquidSceneDescription AddLiquidTap(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    double radius,
    Vector3d velocity,
    double rate = 0,
    double start = 0,
    double end = 0)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
名称文本—The tap's name.
位置Vector3d—The middle of its mouth (m), inside the tank.
半径数字—Its mouth's radius (m); a jet wants a few cells across it.
速度Vector3d—The velocity the liquid leaves with (m/s): (0, 0, -2) pours straight down.
流量(升/秒)数字0How much it pours, in litres a second. 0 is a full jet, its mouth's area times its speed: 31 l/s for a radius of 5 cm at 4 m/s.
开始数字0When it opens (s).
结束数字0When it closes (s); 0: never.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加液体触发器

函数

给场景的物体加入一个触发器后的场景,触发器由触发器节点做出:到某一时刻,每隔一段时间,或者当一个物体碰到什么、升过或落过某个高度、快过某个速度时,它推动一个物体、释放一个被固定住的物体、生成一个物体的副本,或者移除一个物体。一个接一个丢进水箱的箱子,浮子升起时松开的闸门。触发器在物体的每一步之后按加入顺序被检查;它们做了什么,在“液体中的物体”的事件里。实时场景不接受“区域内有水”“引爆”“设置风”和“解除布料固定”,并且在这里就说出来。

签名
添加液体触发器 -> Liquid Scene Description
    场景: Liquid Scene Description
    触发器: Trigger Description
LiquidSceneDescription AddLiquidTrigger(
    LiquidSceneDescription scene,
    TriggerDescription trigger)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
触发器Trigger Description—The trigger. A spawn that repeats has room for 32 bodies the liquid flows round; later ones still fall and collide.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加固体长方体

函数

给场景加一个立在水箱里的实心长方体。

签名
添加固体长方体 -> Liquid Scene Description
    场景: Liquid Scene Description
    名称: 文本
    位置: Vector3d
    大小: Vector3d
LiquidSceneDescription AddSolidBox(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
名称文本—The solid's name.
位置Vector3d—Its centre (m).
大小Vector3d—Its size (m) along X, Y and Z.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

添加固体球

函数

给场景加一个立在水箱里的实心球。

签名
添加固体球 -> Liquid Scene Description
    场景: Liquid Scene Description
    名称: 文本
    位置: Vector3d
    半径: 数字
LiquidSceneDescription AddSolidSphere(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    double radius)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
名称文本—The solid's name.
位置Vector3d—Its centre (m).
半径数字—Its radius (m).

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

导出液体网格

函数

运行场景,把每一帧的液面写成一个网格文件,在碰到水箱的地方封闭;返回写出的文件。

签名
导出液体网格 -> 文本数组
    场景: Liquid Scene Description
    文件夹: 文本
    时长: 数字
    每秒帧数: 数字
    前缀: 文本
    格式: 文本
    平滑: 整数
string[] ExportLiquidMeshes(
    LiquidSceneDescription scene,
    string folder,
    double duration = 1,
    double framesPerSecond = 24,
    string prefix = "liquid",
    string format = "ply",
    int smoothing = 2)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
文件夹文本—The folder; created if missing.
时长数字1How long to run (s).
每秒帧数数字24Frames per second of simulated time.
前缀文本liquidFile name prefix: files are prefix.0001.ply and on.
格式文本plyThe file format: ply (binary, the smallest), obj or stl.
平滑整数2How often the surface is smoothed before it is meshed.

返回

结果文本数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

导出液体网格帧

函数

把一次记录运行中的一帧写成一个网格文件(按路径的后缀是 .ply、.obj 或 .stl),并返回路径。

签名
导出液体网格帧 -> 文本
    结果: Liquid Result
    帧: 整数
    路径: 文本
string ExportLiquidMeshFrame(
    LiquidResult result,
    int frame,
    string path)

参数

名称类型默认值说明
结果Liquid Result—The run.
帧整数—The recorded frame, from 0.
路径文本—The file to write; its folder is created if missing.

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体中的物体

函数

一次记录运行中,场景的物体和固体的运动,作为一个结果:结果节点(物体位置、物体路径、物体网格)读取它,三维视图播放它。它的帧就是这次运行的帧:这里的第 3 帧,就是“液体表面”第 3 帧的那一刻。

签名
液体中的物体(结果: Liquid Result) -> Simulation Result
SimulationResult LiquidBodies(LiquidResult result)

参数

名称类型默认值说明
结果Liquid Result—The run of a scene that has bodies.

返回

结果Simulation Result
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体帧数

函数

一次运行记录了多少帧。

签名
液体帧数(result: Liquid Result) -> 整数
int LiquidFrameCount(LiquidResult result)

参数

名称类型默认值说明
resultLiquid Result—

返回

结果整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体帧粒子数

函数

某一记录帧里液体有多少个粒子:有水龙头和排水口时它会变化。一个粒子是八分之一个单元的液体。

签名
液体帧粒子数(结果: Liquid Result, 帧: 整数) -> 整数
int LiquidFrameParticleCount(LiquidResult result, int frame)

参数

名称类型默认值说明
结果Liquid Result—The run.
帧整数—The recorded frame, from 0.

返回

结果整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体帧时间

函数

某一记录帧的模拟时间(秒)。

签名
液体帧时间(result: Liquid Result, frame: 整数) -> 数字
double LiquidFrameTime(LiquidResult result, int frame)

参数

名称类型默认值说明
resultLiquid Result—
frame整数—

返回

结果数字
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体粒子数

函数

运行结束时液体有多少个粒子。

签名
液体粒子数(result: Liquid Result) -> 整数
int LiquidParticleCount(LiquidResult result)

参数

名称类型默认值说明
resultLiquid Result—

返回

结果整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体图片

函数

把场景运行一段时间,然后给它拍一张照:地面、固体和带着白水的液体,由太阳照亮。

签名
液体图片 -> Pixel Image
    场景: Liquid Scene Description
    时间: 数字
    眼睛: Vector3d
    目标: Vector3d
    宽度: 整数
    高度: 整数
    视场角: 数字
PixelImage LiquidPicture(
    LiquidSceneDescription scene,
    double time,
    Vector3d eye,
    Vector3d target,
    int width = 640,
    int height = 480,
    double fieldOfView = 40)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
时间数字—How long to run before the picture (s).
眼睛Vector3d—Where the camera stands (m).
目标Vector3d—What it looks at (m).
宽度整数640The picture's width in pixels.
高度整数480The picture's height in pixels.
视场角数字40The camera's vertical field of view in degrees.

返回

结果Pixel Image
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体被拒数

函数

运行期间水龙头因为水箱没有空间而没能注入的粒子数;每个水龙头都给足了时为 0。水箱留出的空间是水龙头在它们开着的时间里所注入的量(从不关闭的按二十秒算):关掉水龙头,给水箱排水,或者少运行一会儿。

签名
液体被拒数(result: Liquid Result) -> 大整数
long LiquidRefused(LiquidResult result)

参数

名称类型默认值说明
resultLiquid Result—

返回

结果大整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体表面

函数

某一记录帧的液面,作为一个网格:在碰到水箱的地方封闭,三角形朝外。

签名
液体表面 -> Streamed Vertex Mesh Data
    结果: Liquid Result
    帧: 整数
StreamedVertexMeshData LiquidSurface(
    LiquidResult result,
    int frame)

参数

名称类型默认值说明
结果Liquid Result—The run.
帧整数—The recorded frame, from 0.

返回

结果Streamed Vertex Mesh Data
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

液体表面体积

函数

某一记录帧的液面所围出的体积(立方米):这个网格盛了多少液体。

签名
液体表面体积(结果: Liquid Result, 帧: 整数) -> 数字
double LiquidSurfaceVolume(LiquidResult result, int frame)

参数

名称类型默认值说明
结果Liquid Result—The run.
帧整数—The recorded frame, from 0.

返回

结果数字
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

新建水箱

函数

一个立在地面上的空水箱:它的底和四壁盛住液体。

签名
新建水箱 -> Liquid Scene Description
    大小: Vector3d
    位置: Vector3d
    单元大小: 数字
    白水: 真否
LiquidSceneDescription NewTank(
    Vector3d size,
    Vector3d position,
    double cellSize = 0.025,
    bool whitewater = true)

参数

名称类型默认值说明
大小Vector3d—The tank's size (m) along X, Y and Z (up). It is made of whole cells counted in eights, so each side is rounded up to the next multiple of eight cells: choose a size that is one, such as 1.6 m in cells of 0.025 m, when the walls have to stand exactly there.
位置Vector3d—The middle of the tank's floor (m).
单元大小数字0.025The size of a cell (m): the smallest detail the liquid has. A cell of liquid is eight particles, and halving the size is eight times as many.
白水真否TrueMake spray, foam and bubbles where the liquid breaks; they show in pictures.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

打开水箱

函数

打开水箱后的场景:去掉盖子,或者去掉一面或几面箱壁。到达敞开一侧的液体离开并消失。水箱不在这里打开就是有盖的,溅起来的液体还会落回来。

签名
打开水箱 -> Liquid Scene Description
    场景: Liquid Scene Description
    顶部: 真否
    X 最小的一侧: 真否
    X 最大的一侧: 真否
    Y 最小的一侧: 真否
    Y 最大的一侧: 真否
LiquidSceneDescription OpenTank(
    LiquidSceneDescription scene,
    bool top = true,
    bool minX = false,
    bool maxX = false,
    bool minY = false,
    bool maxY = false)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
顶部真否TrueTake the lid off: liquid thrown over the top is gone.
X 最小的一侧真否FalseTake away the wall at the tank's smallest X.
X 最大的一侧真否FalseTake away the wall at its largest X.
Y 最小的一侧真否FalseTake away the wall at its smallest Y.
Y 最大的一侧真否FalseTake away the wall at its largest Y.

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

设置液体重力

函数

让场景换一个重力(米/秒²),沿 -Z 向下;0 是失重。

签名
设置液体重力 -> Liquid Scene Description
    scene: Liquid Scene Description
    gravity: 数字
LiquidSceneDescription SetLiquidGravity(
    LiquidSceneDescription scene,
    double gravity = 9.81)

参数

名称类型默认值说明
sceneLiquid Scene Description—
gravity数字9.81

返回

结果Liquid Scene Description
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟

模拟液体

函数

把场景运行一段时间,并把每一帧的液面记录成网格,供“液体表面”节点读取。

签名
模拟液体 -> Liquid Result
    场景: Liquid Scene Description
    时长: 数字
    每秒帧数: 数字
    每隔几帧保留: 整数
    平滑: 整数
LiquidResult SimulateLiquid(
    LiquidSceneDescription scene,
    double duration = 1,
    double framesPerSecond = 30,
    int keepEvery = 1,
    int smoothing = 2)

参数

名称类型默认值说明
场景Liquid Scene Description—The scene.
时长数字1How long to run (s).
每秒帧数数字30Frames per second of simulated time.
每隔几帧保留整数1Record every frame (1), every second one (2) and so on; the last frame is always recorded.
平滑整数2How often the surface is smoothed before it is meshed: 0 keeps the particles' unevenness, 2 takes most of it out, more rounds off what is thin.

返回

结果Liquid Result
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
液体
所属包
物理模拟