This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

World Trigger

A world trigger is a cuboid shaped object, which triggers events when any node (physical or not) gets inside or outside of it. The trigger can detect a node of any type by its bound object and can be used to access node's components and parameters.world trigger是一个长方体形状的对象,当任何节点(无论是否存在)进入其内部或外部时,都会触发回调。触发器可以通过其触发器检测任何类型的节点绑定对象并且可以用来访问节点的组件和参数。

注意
Some "abstract" objects do not have bounds; therefore, they do not interact with World Trigger (regardless of the Triggers Interaction option state): Dummy Object (if it has no body assigned)某些“抽象”对象没有边界。因此,它们不会与World Trigger(不管Triggers Interaction选项状态):

World Trigger affecting meshesWorld Trigger影响网格

See also
也可以看看#

Creating a World Trigger
创建一个世界触发器#

To create World Trigger via UnigineEditor:要通过UnigineEditor创建World Trigger,请执行以下操作:

  1. On the Menu bar, choose Create -> Logic -> World Trigger在菜单栏上,选择Create -> Logic -> World Trigger

  2. Place the node in the scene.将节点放置在场景中。

Editing a World Trigger
编辑世界触发器#

In the Node tab of the Parameters window, you can adjust the following parameters of World Trigger:Parameters窗口的Node选项卡中,可以调整World Trigger的以下参数:

Node tab of the World Trigger nodeWorld Trigger节点的Node选项卡

Bounding Box Parameters
边界框参数#

A set of bounding box parameters:一组边界框参数:

Edit Size

Toggles the editing mode for the World Trigger node on and off. When enabled, the bounding box sides that can be resized are highlighted with the colored rectangles. To change the size of a side, drag the corresponding rectangle.开启和关闭World Trigger节点的编辑模式。启用后,可以调整大小的边界框边将用彩色矩形突出显示。要更改边的大小,请拖动相应的矩形。

Touch Toggles the touch mode for World Trigger on and off. With this mode on, World Trigger reacts to the node at a partial contact. Otherwise, World Trigger reacts only if the whole bounding box gets inside it.开启和关闭World Trigger的触摸模式。启用此模式后,World Trigger在部分接触时对节点做出反应。否则,仅当整个边界框进入内部时,World Trigger才会做出反应。
Size The size of the World Trigger bounding box along the X, Y, and Z axes, in units.沿X, YZ轴的World Trigger边界框的大小,以单位为单位。

Handling Events
设置回调#

To perform specific actions when a node enters or leaves the World Trigger, you should implement event handlers that receive a Node as the first argument. Then, you should subscribe to the Enter and/or Leave events and call connect().要在节点进入或离开World Trigger时执行特定的操作,您应该实现接收 node 作为第一个参数的事件处理程序。然后,您应该订阅输入和/或离开事件并调用connect()

源代码 (C++)
// subscribe to the Enter event when a node enters the world trigger with your handler
worldTrigger->getEventEnter().connect(enter_event_handler);
// subscribe to the Leave event when a node leaves the world trigger with your handler
worldTrigger->getEventLeave().connect(leave_event_handler);
源代码 (C#)
// subscribe to the Enter event when a node enters the world trigger with your handler
worldTrigger.EventEnter.Connect(enter_event_handler);
// subscribe to the Leave event when a node leaves the world trigger with your handler
worldTrigger.EventLeave.Connect(leave_event_handler);
最新更新: 2024-04-19
Build: ()