first commit
This commit is contained in:
201
docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md
Normal file
201
docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md
Normal file
@@ -0,0 +1,201 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 世界
|
||||
|
||||
## VirtualWorldCreate
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.virtualWorldCompClient.VirtualWorldCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
创建虚拟世界,虚拟世界只允许存在一个,已经存在虚拟世界的情况下再调用此方法则无效
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否创建成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import client.extraClientApi as clientApi
|
||||
virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())
|
||||
virtualWorldComp.VirtualWorldCreate()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## VirtualWorldDestroy
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.virtualWorldCompClient.VirtualWorldCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
销毁虚拟世界
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否销毁成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import client.extraClientApi as clientApi
|
||||
virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())
|
||||
virtualWorldComp.VirtualWorldDestroy()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## VirtualWorldSetCollidersVisible
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.virtualWorldCompClient.VirtualWorldCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
设置虚拟世界中模型的包围盒是否显示,主要用于调试,默认为不显示
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| isVisible | bool | 是否显示 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import client.extraClientApi as clientApi
|
||||
virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())
|
||||
virtualWorldComp.VirtualWorldSetCollidersVisible(True)
|
||||
|
||||
id = virtualWorldComp.ModelCreateObject("datiangou", "run")
|
||||
virtualWorldComp.ModelSetBoxCollider(id, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## VirtualWorldSetSkyBgColor
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.virtualWorldCompClient.VirtualWorldCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
设置虚拟世界中天空背景的颜色
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| color | tuple(float,float,float) | 颜色的r,g,b值,均为0.0到1.0的浮点值 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import client.extraClientApi as clientApi
|
||||
virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())
|
||||
#设置天空为红色
|
||||
virtualWorldComp.VirtualWorldSetSkyBgColor((1.0, 0.0, 0.0))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## VirtualWorldSetSkyTexture
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.virtualWorldCompClient.VirtualWorldCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
设置虚拟世界中天空的贴图
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| texturePath | str | 贴图路径 |
|
||||
| mode | int | 拉伸模式,0或1。0代表贴图宽高都拉伸至全屏,可能造成贴图变形;1代表高度拉伸至全屏,宽度按贴图原宽高比进行相应缩放,能保持贴图不被拉伸,但会造成贴图超出屏幕或不完全铺满屏幕。 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import client.extraClientApi as clientApi
|
||||
virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())
|
||||
virtualWorldComp.VirtualWorldSetSkyTexture("textures/virtualWorldSky", 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## VirtualWorldToggleVisibility
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.virtualWorldCompClient.VirtualWorldCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
设置虚拟世界是否显示
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| isVisible | bool | 是否显示 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 备注
|
||||
- 建议在需要频繁在主世界跟虚拟世界切换的时候使用该方法,若后续长时间不需要使用虚拟世界,建议调用VirtualWorldDestroy进行销毁释放资源
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import client.extraClientApi as clientApi
|
||||
virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())
|
||||
virtualWorldComp.VirtualWorldToggleVisibility(False)
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user