元編程參考文件

液體

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