元編程參考文件

海岸

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
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海岸
所屬包
物理模擬