This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound 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

障碍物

An obstacle is an invisible object which is placed inside a navigation area and is bypassed during pathfinding.障碍物是放置在导航区域内的不可见对象,在寻路过程中会被绕过。

注意
If you change obstacle transformation, route will be automatically recalculated in order to avoid the obstacle.如果更改障碍物变换,则会自动重新计算路线,以避开障碍物。

The obstacles can be added to the scene:可以将障碍物添加到场景中:

  • As a single node to indicate an area or a node that should be avoided during pathfinding. However, if you change transformation of the node, the obstacle transformation won't change.作为单个节点来指示在寻路过程中应避免的区域或节点。但是,如果更改节点的变换,则障碍物变换不会改变。
  • As a child node of a node that should be bypassed. In this case, transformation of the obstacle will change together with the node transformation and a route will always be calculated correctly.作为应绕过的节点的子节点。在这种情况下,障碍物的变换将与节点变换一起更改,并且始终会正确计算路线。

There are 3 types of the obstacles:障碍分为3种类型:

You should choose the most appropriate type depending on the form of the node that should be bypassed during pathfinding.您应根据在寻路过程中应绕过的节点的形式选择最合适的类型。

Usage Example
使用范例#

Supposing, you need to add a node that changes its transformation each frame and should be bypassed during pathfinding. In this case, you should do the following:假设您需要添加一个节点,该节点会在每帧中更改其变换,并且在寻路过程中应绕过该节点。在这种情况下,您应该执行以下操作:

  1. Place the required node inside the navigation area within which routes will be calculated.将所需的节点放置在将要计算路线的导航区域内。

    A cuboid-shaped ObjectMeshDynamic node placed inside the Navigation Sector放置在Navigation Sector内的长方体形状的ObjectMeshDynamic节点
  2. Add the obstacle of the required type to the scene and combine its position with the node's position.将所需类型的障碍物添加到场景中,并将其位置与节点的位置结合起来。
  3. Set the required size for the obstacle.设置障碍物所需的大小。

    The obstacle box and the node.障碍箱和节点。
  4. In the World Hierarchy window, drag the obstacle node to make it a child of the required node.World Hierarchy窗口中,将障碍物节点拖动到做个孩子所需节点的数量。

    注意
    This will enable to simultaneously change transformation of the node and the obstacle. You can also perform it via code.这将使得能够同时改变节点和障碍物的变换。您也可以执行通过代码
  5. Now you can create a route from the script. The route will be automatically recalculated when the node transformation changes.现在你可以创建一条路线从脚本。节点转换更改时,将自动重新计算路线。

In the result, the route will be calculated as follows (the route is highlighted with white):结果,将按以下方式计算路线(路线以白色突出显示):

The route that bypasses the node marked as the obstacle box绕过标记为障碍箱的节点的路线

See Also
也可以看看#

最新更新: 2024-08-16
Build: ()