元编程参考文档

海岸

22 个节点

本页内容 22

添加海岸上的物体

函数

在海岸上放一个刚体后的海岸,刚体由长方体、球、胶囊等物体节点做出。比水(1025 千克/立方米)轻的物体在水够深的地方浮着,随波起伏,被水流带着走;水太浅或者退走了的地方,它就躺在底床上。更重的物体沉到底床上不动。物体之间会碰撞。它们不扰动水。

签名
添加海岸上的物体 -> Shore Scene Description
    场景: Shore Scene Description
    物体: Body Description
ShoreSceneDescription AddShoreBody(
    ShoreSceneDescription scene,
    BodyDescription body)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
物体Body Description—The body. Put it at about the sea's level to float, or just above the sand to lie there (Shore Bed Height gives the sand's height at a point).

返回

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

添加海岸土丘

函数

海床上加一个土丘后的海岸:波浪最先在上面破碎的沙洲,一块礁石,一座小岛;高度为负时,是一条水道或一个水潭。

签名
添加海岸土丘 -> Shore Scene Description
    场景: Shore Scene Description
    位置: Vector3d
    半径: 数字
    高度: 数字
    拉伸: 数字
ShoreSceneDescription AddShoreMound(
    ShoreSceneDescription scene,
    Vector3d position,
    double radius = 10,
    double height = 1.5,
    double stretch = 1)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
位置Vector3d—The mound's middle (m); its Z is not used.
半径数字10How wide it is (m).
高度数字1.5How high it stands above the bed around it (m); negative digs.
拉伸数字1How many times longer it is along the shore (Y) than across it: 1 is round, 10 a bar.

返回

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

添加海岸触发器

函数

给海岸上的物体加入一个触发器后的海岸,触发器由触发器节点做出:到某一时刻,每隔一段时间,或者当一个物体碰到另一个、升过或落过某个高度、快过某个速度时,它推动一个物体、释放一个被固定住的物体、生成一个物体的副本,或者移除一个物体。浪涌到时从沙滩上松开的小船,一块一块漂来的浮木。触发器在物体的每一步之后按加入顺序被检查;它们做了什么,在“海岸上的物体”的事件里。海岸不接受“区域内有水”“引爆”“设置风”和“解除布料固定”,并且在这里就说出来。

签名
添加海岸触发器 -> Shore Scene Description
    场景: Shore Scene Description
    触发器: Trigger Description
ShoreSceneDescription AddShoreTrigger(
    ShoreSceneDescription scene,
    TriggerDescription trigger)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
触发器Trigger Description—The trigger.

返回

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

导出海岸网格

函数

把一次运行每一记录帧的水面写成网格文件,单位为米,采用 Divooka 的坐标轴(+Z 向上)。返回写出的文件。

签名
导出海岸网格 -> 文本数组
    结果: Shore Result
    文件夹: 文本
    前缀: 文本
    格式: 文本
    每隔几格: 整数
string[] ExportShoreMeshes(
    ShoreResult result,
    string folder,
    string prefix = "shore",
    string format = "ply",
    int every = 1)

参数

名称类型默认值说明
结果Shore Result—The run.
文件夹文本—The folder; created if missing.
前缀文本shoreFile name prefix: files are prefix.0001.ply and on.
格式文本plyThe file format: ply (binary, the smallest), obj or stl.
每隔几格整数1Use every cell (1), every second one (2) and so on.

返回

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

新建海滩

函数

一片海滩:海床从 -X 起先平躺在海面下一段,然后均匀升起,穿过水线,到 +X 处的陆地,沿 Y 处处相同。“添加海岸土丘”给它加上沙洲、礁石和水道。

签名
新建海滩 -> Shore Scene Description
    长度: 数字
    宽度: 数字
    位置: Vector3d
    深度: 数字
    升高: 数字
    单元大小: 数字
ShoreSceneDescription NewBeach(
    double length = 200,
    double width = 120,
    Vector3d position,
    double depth = 5,
    double rise = 3,
    double cellSize = 0.5)

参数

名称类型默认值说明
长度数字200The area's extent along X, from the sea to the land (m).
宽度数字120Its extent along Y, along the shore (m).
位置Vector3d—The corner of the area at its lowest X and Y (m).
深度数字5How deep the sea is where the swell comes in (m).
升高数字3How high the land is at the far end, above the sea (m).
单元大小数字0.5The size of a cell (m): the smallest detail of the water. A wave wants a dozen cells along its length.

返回

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

由高度图新建海岸

函数

海床是一张图片的海岸:暗处低,亮处高。图片被铺满整个范围,左边在海的一侧(-X),上边在 Y 最大处。画出来的或由其他节点做出的地形就成了一段海岸。

签名
由高度图新建海岸 -> Shore Scene Description
    高度图: Pixel Image
    长度: 数字
    宽度: 数字
    位置: Vector3d
    最低: 数字
    最高: 数字
    单元大小: 数字
ShoreSceneDescription NewShoreFromHeights(
    PixelImage heights,
    double length = 200,
    double width = 120,
    Vector3d position,
    double lowest = -5,
    double highest = 5,
    double cellSize = 0.5)

参数

名称类型默认值说明
高度图Pixel Image—The picture; its brightness is the height.
长度数字200The area's extent along X (m).
宽度数字120Its extent along Y (m).
位置Vector3d—The corner of the area at its lowest X and Y (m).
最低数字-5The height black stands for (m): below the sea's level, which is 0.
最高数字5The height white stands for (m).
单元大小数字0.5The size of a cell (m).

返回

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

设置海岸外观

函数

在图片里换一种样子的海岸。

签名
设置海岸外观 -> Shore Scene Description
    场景: Shore Scene Description
    太阳方向: Vector3d
    涟漪: 真否
ShoreSceneDescription SetShoreLook(
    ShoreSceneDescription scene,
    Vector3d sunDirection,
    bool ripples = true)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
太阳方向Vector3d—Where the sun stands, as a direction towards it.
涟漪真否TrueShow small wind waves on top of the swell.

返回

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

设置海岸的海

函数

让一个海洋场景的海涌进来后的海岸:那个场景的风所掀起的长波成为海岸的涌浪,取代原来两道规则的长涌,它的短波则成为图片里的细浪。于是一段海岸就是同一阵风下的两个场景:海洋节点的外海,以及它的波浪在这里变浅、破碎。只有相对于靠海一侧的水深足够长的波才进得来,那是浅水所能承载的:“海岸来浪高度”说出它们有多高,微风吹在深水上则一道也送不进来。在这之后再用“设置海岸波浪”,会在上面叠加一道远方来的规则长涌。

签名
设置海岸的海 -> Shore Scene Description
    场景: Shore Scene Description
    海: Ocean Scene Description
ShoreSceneDescription SetShoreSea(
    ShoreSceneDescription scene,
    OceanSceneDescription sea)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
海Ocean Scene Description—The sea: its wind's speed and direction and its seed are taken. A wind that blows to +X (0°) comes straight on shore; one that blows along the shore or off it sends its waves in slanted, or not at all.

返回

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

设置海岸波浪

函数

换一种从海上涌来的长涌后的海岸。

签名
设置海岸波浪 -> Shore Scene Description
    场景: Shore Scene Description
    振幅: 数字
    周期: 数字
    第二振幅: 数字
    第二周期: 数字
ShoreSceneDescription SetShoreWaves(
    ShoreSceneDescription scene,
    double amplitude = 0.4,
    double period = 8,
    double secondAmplitude = 0.25,
    double secondPeriod = 9.7)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
振幅数字0.4The swell's height from its middle to its crest (m): 0.4 breaks gently on a beach, 1 is surf.
周期数字8Its period (s): 6 is wind sea, 8 to 12 swell from far off.
第二振幅数字0.25The height of a second swell (m), which makes the waves come in sets; 0: none.
第二周期数字9.7The second swell's period (s).

返回

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

海床

函数

海岸的海床,作为一个网格:沙、沙洲和礁石,不含水。三维视图会把它画出来。

签名
海床 -> Streamed Vertex Mesh Data
    场景: Shore Scene Description
    每隔几格: 整数
StreamedVertexMeshData ShoreBed(
    ShoreSceneDescription scene,
    int every = 1)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
每隔几格整数1Use every cell (1), every second one (2) and so on: a coarser mesh of a large shore.

返回

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

海床高度

函数

某一点处海床的高度(米)。

签名
海床高度(场景: Shore Scene Description, 位置: Vector3d) -> 数字
double ShoreBedHeight(
    ShoreSceneDescription scene,
    Vector3d position)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
位置Vector3d—The point; its Z is not used.

返回

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

海岸上的物体

函数

一次记录运行中海岸上物体的运动,作为一个结果:结果节点(物体位置、物体路径、物体网格)读取它,三维视图播放它。它的帧就是这次运行的帧:这里的第 3 帧,就是这次运行所记录的第 3 帧时的物体。

签名
海岸上的物体(结果: Shore Result) -> Simulation Result
SimulationResult ShoreBodies(ShoreResult result)

参数

名称类型默认值说明
结果Shore Result—The run.

返回

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

海岸泡沫图

函数

某一记录帧的泡沫,作为一张从上往下看的图片:波浪破碎的地方是白的。列沿 X(海在左边),最上一行是 Y 最大处。

签名
海岸泡沫图(结果: Shore Result, 帧: 整数) -> Pixel Image
PixelImage ShoreFoamMap(ShoreResult result, int frame)

参数

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

返回

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

海岸帧数

函数

一次运行记录了多少帧。

签名
海岸帧数(result: Shore Result) -> 整数
int ShoreFrameCount(ShoreResult result)

参数

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

返回

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

海岸帧时间

函数

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

签名
海岸帧时间(result: Shore Result, frame: 整数) -> 数字
double ShoreFrameTime(ShoreResult result, int frame)

参数

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

返回

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

海岸图片

函数

把海岸运行一段时间,然后给它拍一张照:沙,带着泡沫的水,被水带到各处的物体,以及范围之外平静的海,由场景的太阳照亮。

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

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
时间数字—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
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
海岸
所属包
物理模拟

海岸上冲

函数

某一记录帧里水沿海滩冲到了多远:有水的最大 X(米)。

签名
海岸上冲(结果: Shore Result, 帧: 整数) -> 数字
double ShoreRunUp(ShoreResult result, int frame)

参数

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

返回

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

海岸来浪高度

函数

从海岸靠海一侧涌进来的海的有效波高(米):那里最高的三分之一波浪从波谷到波峰的平均高度。海岸没有设置海(“设置海岸的海”),或者它的风的波浪对那一侧的水来说都太短、浅水承载不了时为 0:更强的风或者更浅的靠海一侧能让它们进来。浪高超过水深的大约一半时,一进来就破碎。

签名
海岸来浪高度(场景: Shore Scene Description) -> 数字
double ShoreSeaHeight(ShoreSceneDescription scene)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.

返回

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

海岸水面

函数

某一记录帧的水面,作为一个网格:一张敞开的面,盖在有水的单元上,到海滩干的地方为止。三维视图会把它画出来;下面垫上“海床”,就是海岸。

签名
海岸水面 -> Streamed Vertex Mesh Data
    结果: Shore Result
    帧: 整数
    每隔几格: 整数
StreamedVertexMeshData ShoreSurface(
    ShoreResult result,
    int frame,
    int every = 1)

参数

名称类型默认值说明
结果Shore Result—The run.
帧整数—The recorded frame, from 0.
每隔几格整数1Use every cell (1), every second one (2) and so on.

返回

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

海岸水深

函数

某一记录帧里某一点的水有多深(米):沙是干的地方为 0。配上一个物体的位置,它就说出这个物体是浮着还是搁浅了。

签名
海岸水深(结果: Shore Result, 帧: 整数, 位置: Vector3d) -> 数字
double ShoreWaterDepth(
    ShoreResult result,
    int frame,
    Vector3d position)

参数

名称类型默认值说明
结果Shore Result—The run.
帧整数—The recorded frame, from 0.
位置Vector3d—The point; its Z is not used.

返回

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

海岸水量

函数

某一记录帧里范围内有多少水(立方米)。

签名
海岸水量(结果: Shore Result, 帧: 整数) -> 数字
double ShoreWaterVolume(ShoreResult result, int frame)

参数

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

返回

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

模拟海岸

函数

把海岸运行一段时间,并记录每一帧的水,供表面节点读取。一帧每个单元 8 字节,所以大的海岸要少记几帧(每隔几帧保留)。最初的波浪要过一会儿才越过整个范围:水深 5 米时它们每秒走 7 米。

签名
模拟海岸 -> Shore Result
    场景: Shore Scene Description
    时长: 数字
    每秒帧数: 数字
    每隔几帧保留: 整数
ShoreResult SimulateShore(
    ShoreSceneDescription scene,
    double duration = 30,
    double framesPerSecond = 30,
    int keepEvery = 30)

参数

名称类型默认值说明
场景Shore Scene Description—The shore.
时长数字30How long to run (s).
每秒帧数数字30Frames per second of simulated time.
每隔几帧保留整数30Record every frame (1), every second one (2) and so on; the last frame is always recorded.

返回

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