This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
Content Optimization
Materials
Art Samples
Tutorials

World Trigger

A world trigger is a cuboid shaped object, which fires callbacks 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也可以看看#

  • WorldTrigger class to manage World Trigger via APIWorldTrigger类可通过API管理World Trigger
  • A set of samples located in the data/samples/worlds folder:位于data/samples/worlds文件夹中的一组样本:

    1. trigger_01
    2. trigger_02

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边界框的大小,以单位为单位。

Setting Up Callbacks设置回调#

To add an enter or leave callback, write a callback function that receives a Node as its first argument. Then use the addEnterCallback or addLeaveCallback method to specify the function to be called.要添加回车或离开回调,请编写一个接收以下内容的回调函数:节点作为第一个论点。然后使用addEnterCallbackaddLeaveCallback方法指定要调用的函数。

源代码 (C++)
// add the enter callback to be fired when a node enters World Trigger
worldTrigger->addEnterCallback(MakeCallback(this, &AppWorldLogic::enter_callback));
// add the leave callback to be fired when a node leaves World Trigger
worldTrigger->addLeaveCallback(MakeCallback(this, &AppWorldLogic::leave_callback));
源代码 (C#)
// add the enter callback to be fired when a node enters World Trigger
worldTrigger.AddEnterCallback(enter_callback);
// add the leave callback to be fired when a node leaves World Trigger
worldTrigger.AddLeaveCallback(leave_callback);
最新更新: 2021-05-26
Build: ()