元编程参考文档

海岸会话

19 个节点

本页内容 19

推进

函数

把水推进一段模拟时间(秒),每步不超过六十分之一秒。

签名
推进(Shore Session: Shore Session, seconds: 数字)
void Advance(ShoreSession Shore Session, double seconds)

参数

名称类型默认值说明
Shore SessionShore Session—
seconds数字—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

物体位置

函数

一个物体此刻的位置(米)。

签名
物体位置(Shore Session: Shore Session, 名称: 文本) -> Vector3d
Vector3d BodyPosition(ShoreSession Shore Session, string name)

参数

名称类型默认值说明
Shore SessionShore Session—
名称文本—Its name.

返回

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

物体朝向

函数

一个物体此刻的朝向。

签名
物体朝向 -> Quaterniond
    Shore Session: Shore Session
    名称: 文本
Quaterniond BodyRotation(
    ShoreSession Shore Session,
    string name)

参数

名称类型默认值说明
Shore SessionShore Session—
名称文本—Its name.

返回

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

物体速度

函数

一个物体此刻的速度(米/秒)。

签名
物体速度(Shore Session: Shore Session, 名称: 文本) -> Vector3d
Vector3d BodyVelocity(ShoreSession Shore Session, string name)

参数

名称类型默认值说明
Shore SessionShore Session—
名称文本—Its name.

返回

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

捕获物体

函数

物体此刻的样子,取为一个帧,三维视图会把它画出来。

签名
捕获物体(Shore Session: Shore Session) -> Simulation Frame
SimulationFrame CaptureBodies(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—

返回

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

结束会话

函数

结束会话,把它在显卡上的内存还回去。

签名
结束会话(Shore Session: Shore Session)
void Dispose(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

帧

函数

How many frames Step Frame has stepped.

签名
帧(Shore Session: Shore Session) -> 整数
int Frame(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—

返回

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

场景

函数

The scene the session started from.

签名
场景(Shore Session: Shore Session) -> Shore Scene Description
ShoreSceneDescription Scene(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—

返回

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

时间

函数

Simulated time (s).

签名
时间(Shore Session: Shore Session) -> 数字
double Time(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—

返回

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

推动物体

函数

在一个物体的中心推它一下:一个冲量(牛·秒),即它的质量乘以速度的变化。一条被推下沙滩的小船,一阵风。

签名
推动物体
    Shore Session: Shore Session
    名称: 文本
    冲量: Vector3d
void PushBody(
    ShoreSession Shore Session,
    string name,
    Vector3d impulse)

参数

名称类型默认值说明
Shore SessionShore Session—
名称文本—The body's name.
冲量Vector3d—The impulse (N·s).
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

渲染

函数

海岸此刻的一张图片。

签名
渲染 -> Pixel Image
    Shore Session: Shore Session
    眼睛: Vector3d
    目标: Vector3d
    宽度: 整数
    高度: 整数
    视场角: 数字
PixelImage Render(
    ShoreSession Shore Session,
    Vector3d eye,
    Vector3d target,
    int width = 640,
    int height = 480,
    double fieldOfView = 40)

参数

名称类型默认值说明
Shore SessionShore Session—
眼睛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
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

设置海

函数

把涌进来的海换成另一个海洋场景的海:风在增强、转向或停息。已经在海岸上的波浪继续走,新的跟在它们后面进来。

签名
设置海
    Shore Session: Shore Session
    海: Ocean Scene Description
void SetSea(
    ShoreSession Shore Session,
    OceanSceneDescription sea)

参数

名称类型默认值说明
Shore SessionShore Session—
海Ocean Scene Description—The sea whose wind is taken.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

设置波浪

函数

改变从海上涌来的长涌:风暴渐起,或渐息。

签名
设置波浪(Shore Session: Shore Session, 振幅: 数字, 周期: 数字)
void SetWaves(
    ShoreSession Shore Session,
    double amplitude,
    double period = 8)

参数

名称类型默认值说明
Shore SessionShore Session—
振幅数字—Its height from its middle to its crest (m).
周期数字8Its period (s).
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

步进一帧

函数

按某个帧率把水推进一帧。

签名
步进一帧(Shore Session: Shore Session, framesPerSecond: 数字)
void StepFrame(
    ShoreSession Shore Session,
    double framesPerSecond = 30)

参数

名称类型默认值说明
Shore SessionShore Session—
framesPerSecond数字30
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
海岸会话
所属包
物理模拟

表面

函数

此刻的水面,作为一个盖在有水单元上的网格。

签名
表面 -> Streamed Vertex Mesh Data
    Shore Session: Shore Session
    每隔几格: 整数
StreamedVertexMeshData Surface(
    ShoreSession Shore Session,
    int every = 1)

参数

名称类型默认值说明
Shore SessionShore Session—
每隔几格整数1Use every cell (1), every second one (2) and so on.

返回

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

取出事件

函数

自上次调用以来场景的触发器做了什么,最早的在前:每触发一次就是一个事件,带着它的时间、地点和所涉及的物体。没有触发过,或者海岸没有触发器时为空。

签名
取出事件(Shore Session: Shore Session) -> Simulation Event 数组
SimulationEvent[] TakeEvents(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—

返回

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

水深

函数

此刻某一点的水有多深(米):沙是干的地方为 0。

签名
水深(Shore Session: Shore Session, 位置: Vector3d) -> 数字
double WaterDepth(ShoreSession Shore Session, Vector3d position)

参数

名称类型默认值说明
Shore SessionShore Session—
位置Vector3d—The point; its Z is not used.

返回

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

水量

函数

此刻范围内有多少水(立方米)。

签名
水量(Shore Session: Shore Session) -> 数字
double WaterVolume(ShoreSession Shore Session)

参数

名称类型默认值说明
Shore SessionShore Session—

返回

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

开始海岸会话

函数

从一个海岸场景开始一个会话。

签名
开始海岸会话(场景: Shore Scene Description) -> Shore Session
ShoreSession Start(ShoreSceneDescription scene)

参数

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

返回

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