zoukankan      html  css  js  c++  java
  • High-level NavMesh Building Components

     

    Here we introduce four high level components for the navigation system:

    //这里我们介绍四个高水平导航系统组件:

     

    • NavMeshSurface – for building and enabling a navmesh surface for one agent type.

    • NavMeshModifier – affects the navmesh generation of navmesh area types, based on the transform hierarchy.

    • NavMeshModifierVolume – affects the navmesh generation of navmesh area types, based on volume.

    • NavMeshLink – connects same or different navmesh surfaces for one agent type.

    //

    • NavMeshSurface——用于构建和启用navmesh表面为一个代理类型。

    • NavMeshModifier——影响导航区类型的导航网格生成,,基于变换的层次结构。

    • NavMeshModifierVolume——影响导航区类型的导航网格生成,基于体积。

    • NavMeshLink——连接为一个代理类型相同或不同的navmesh表面。


    These components comprise the high level controls for building and using NavMeshes at runtime as well as edit time.

    //这些组件包括高水平控制在运行时建立和使用navmeshes以及编辑时间。

    NavMeshSurface//导航网格表面

    The NavMeshSurface component represents the walkable area for a specific agent type. The NavMesh Surface component defines a part of the world where a NavMesh should be built. A scene can contain multiple NavMesh Surfaces.

     

    The preferred way to use the NavMeshSurface component is to create an empty Game Object containing the NavMeshSurface component. There’s a menu option for that: GameObject > AI > NavMesh Surface. This creates an empty Game Object with a NavMeshSurface component attached to it.

     

    The NavMeshSurface component can be also added to any game object. This is useful for cases where you want to use the Hierarchy to define which objects contribute to the NavMesh.

    //

    NavMeshSurface组件代表一个特定的代理类型的步行区。导航网格表面组件定义了世界的一部分,当一个导航被建立的时候。一个场景可以包含多个导航网格曲面。

    使用NavMeshSurface组件的首选方法是创建一个空的游戏对象,包含NavMeshSurface组件。有一个菜单选项:GameObject > AI > NavMesh Surface。这将创建一个空的游戏物体NavMeshSurface组件连接到它。

    NavMeshSurface组件也可以添加到任何游戏对象。这是有用的情况下,您想要使用的层次结构来定义对象NavMesh做出贡献。


    Parameters//参数

    • Agent Type – the agent type which will use this NavMesh Surface. The agent type is used for bake settings, as well as to match a NavMeshAgent to proper surface during pathfinding.

    • Collect Objects – defines on a high level which objects should be used for baking.

      • All – use all active objects.

      • Volume – use all active objects overlapping the bounding volume (defined later)

      • Children – use all active objects which are children to the NavMeshSurface component, in addition to the object the component is placed on.

    • Include Layers – defines the layers on which the objects must be to be included in the bake. This allows further culling of objects from inclusion in the bake e.g. effects or animated characters.

    • Use Geometry – selects which geometry is used for baking.

      • Render Meshes – use geometry from rendered meshes and terrains

      • Physics Colliders – use geometry from colliders and terrains. When using physics this is usually a better option than Render Meshes. This way the agents will be closer to the physical bounds of the environment.

    //

    • 代理类型–代理类型,将使用该导航网格表面。代理型用于烘焙设置,以及匹配一个NavMeshAgent在寻路的表面。

    • 收集的对象–定义在一个高水平的对象应用于烘焙。

      • 全部–使用活动对象。

      • 体积–使用所有活动对象重叠边界体积(定义之后)

      • 子对象–使用活动对象是子对象的navmeshsurface组件,除了放置对象的组件。

    • 包括层–定义层上的对象必须被包括在烘焙。这允许进一步剔除的对象包含在烘焙如效果或动画人物。

    • 使用几何–选择几何用于烘焙。

      • 渲染网格–使用几何渲染网格和地形

      • 对撞机–使用几何对撞机和地形。利用物理时,这通常是一个比较好的选择渲染网格。这样,代理将更接近物理环境的界限。

     

    The main settings for the NavMesh Surface component allow you to filter the input geometry on a broad scale. To fine tune how input geometry is treated on a per-object level when building a navmesh, see NavMeshModifer component.

     

    Game Objects which have a NavMesh Agent or NavMesh Obstacle will be excluded from the baking process automatically. They are dynamic users of the navmesh – and hence should not contribute to the navmesh building.

    //

    在导航网格表面组件的主要设置允许你过滤输入几何体在广泛的范围内。调整输入几何是如何处理每一个对象的水平导航网格时,看到NavMeshModifer组件。

    其中有一个游戏对象导航网格代理导航网格的障碍将被排除在烘干过程中自动。他们的导航–动态用户因此不应该有助于导航建设。


    Advanced Settings//高级设置

    The main settings will cater for most use cases, but for anything not covered by the main settings, the advanced section has the following additional parameters

    //主要的设置将满足大多数用例,但没有覆盖的主要设置,高级部分有以下额外的参数

      • Default Area – defines the area type generated when building the navmesh. The default value is Walkable. The NavMeshModifer component can be used to modify the area type in more detail.

      • Override Voxel Size – The override voxel size controls how accurately the input geometry is processed for NavMesh baking. It is a tradeoff between speed and accuracy. A good value to start with is 3 voxels per agent radius (6 per diameter). This allows to capture most of the narrow passages, like doors and still have quick baking. If you have big open areas, you might go down to 1 or 2 to speed things up. Or if you have tight indoor spots, you can use smaller voxels, and use maybe 4-6 voxels per radius. More than 8 is usually not really worth it.   

      • Override Tile Size – In order to make the bake process parallel and memory efficient, the world is divided into tiles for baking. The white lines you can see on your NavMesh are tile boundaries. The default tiles size is 256 voxels. It is a good trade-off between memory usage and NavMesh fragmentation. The smaller the tiles are the more fragmented the NavMesh is, and this can sometimes cause non-optimal paths. NavMesh carving also operates on tiles. If you have a lot of obstacles, you can potentially speed up carving by making the tile size smaller, say 64-128. Also, if you plan to bake the NavMesh at runtime, you may choose to use smaller tile size to keep the maximum memory usage low.

      • Build Height Mesh – Not supported yet.

     //

      • 默认区域–定义navmesh类型构建时生成的区域。默认值是步行。NavMeshModifer组件可以用来修改详细的区域类型。

      • 覆盖体素的大小–覆盖体素的大小控制准确输入几何NavMesh烘焙处理。这是一个速度和精度之间的权衡。最好的值是每剂半径3像素(6直径)。这允许捕捉最狭窄的通道,像门,还有快速烘焙。如果你有大的开放区域,你可以去1或2加快速度。或者如果你有紧张的室内景点,你可以使用更小的像素,并使用也许每4-6像素半径。超过8通常是不值得的。

      • 覆盖瓷砖大小–为了使烘焙过程并行高效,世界是分为瓷砖烘焙。你可以看到在你的导航白线是瓷砖的边界。默认的瓷砖尺寸是256像素。这是一个很好的权衡内存使用和导航的碎片。NavMesh越分散越小,这有时会导致非最优路径。NavMesh雕刻也作用于瓷砖。如果你有一个很大的障碍,你可能会加快雕刻的瓷砖尺寸更小,例如64-128。另外,如果你打算烘焙的导航在运行时,你可以选择使用更小的瓷砖尺寸保持低的最大内存使用量。

      • 构建高度网格–还不支持。


    NavMesh Modifier//导航网格修改

     

     

    NavMesh Modifier allows to fine tune how a specific object behaves during NavMesh baking. In the above picture, the lower platform has modifier attached to it, which sets the object to have Lava area type.

     

    The NavMesh Modifier affects hierarchically, that is, the Game Object where the Components is attached and all of its’ children are affected. If another NavMesh Modifier is found further down the transform hierarchy it will override the modification for its children.

     

    The NavMesh Modifier affects the NavMesh generation process, this means the NavMesh has to be updated to reflect changes to NavMesh Modifiers.

    //

    导航网格修改器允许微调如何表现在特定对象导航烘焙。在上面的图片中,下平台连接到它的改性剂,使对象有熔岩区类型。

     

    导航网格修改影响层次,即游戏对象的组件连接及其所有的子对象都受到影响。如果另一个导航改性剂的发现进一步下跌的变换法将覆盖其子对象的修改。

     

    导航网格修改影响导航网格生成过程,这意味着NavMesh必须更新,以反映更改NavMesh改性剂。

     

    Note: This component is a replacement for the old setting which could be enabled from the Navigation window Objects tab as well as the static flags dropdown on the GameObject. This component is available for baking at runtime, whereas the static flags are available in the editor only.

    //

    注意:该组件是一个替代旧的设置可以启用的选项卡导航窗口对象以及静态GameObject旗帜下拉。该组件是在运行时用于烘焙,而静态标志仅在编辑器中可用。

     

    Parameters//参数

     

      • Ignore From Build – when checked, the object and all if its’ children are skipped from the build process.

      • Override Area Type – when checked the area type will be overridden for the game object containing the Modifier and all of it’s children.

        • Area Type – new area type to apply

      • Affected Agents – a selection of agents the Modifier affects. For example, you may choose to exclude certain obstacles from specific agent.

     //

      • 忽视构建–检查时,对象及其所有的子对象如果跳过的构建过程。

      • 覆盖区域类型–选中区域类型将含有改性剂和它的所有子对象重写。

        • 区域类型–新领域应用类型

      • 影响代理–选择代理的改进性影响。例如,你可以选择排除某些障碍从特定的代理。

    NavMesh Modifier Volume//导航网格修正量

    NavMesh Modifier Volume allows you to mark the area that falls inside the volume with specific area type. Where NavMesh Modifier marks certain objects with an area type, the Modifier Volume allows change the area type even more locally based on a volume.

     

    The modifier is useful for annotating certain areas over walkable surfaces which might not be represented as separate geometry, e.g. danger areas.  It can be even be used to make certain areas non-walkable.

     

    The NavMesh Modifier Volume affects the NavMesh generation process, this means the NavMesh has to be updated to reflect changes to NavMesh Modifier Volumes.

     //

    NavMesh Modifier Volume允许你标记的区域正好落在体积与特定区域类型。在导航网格修改标志与区域类型特定的对象,Modifier Volume允许改变区域类型更多的本地基于体积。

     

    改性剂是有用的对某些领域的步行的表面不可能是表示为单独的几何体,例如危险区域。它甚至可以被用来确定non-walkable领域。

     

    NavMesh Modifier Volume影响导航网格生成过程,这意味着NavMesh必须更新,以反映NavMesh Modifier Volume的改变。

     

    Parameters//参数

     

      • Size – dimensions of the modifier volume.

      • Center – center of the modifier volume relative to the GameObject center.

      • Area Type – describes the area type which the volume applies.

      • Affected Agents – a selection of agents the Modifier affects. For example, you may choose to create danger zone for specific agent type only.

     //

      • 大小改性剂的体积。

      • 机构–改性剂的体积相对于物体中心。

      • 区域类型–描述了区域类型体积适用。

      • 影响代理–选择代理的改进性影响。例如,你可以选择创建危险区特定的代理类。

    NavMesh Link//导航链接

    NavMesh Link allows to create a navigable link between two locations. The link can be from point-to-point, or it can be wider in which case the agent uses the nearest location along entry edge to cross the link.

     

    The link is necessary to connect different NavMesh Surfaces

    //

    导航链接允许创建两个地点之间可通航的链接。链接可以从点对点,也可以是更广泛的在这种情况下,代理使用最近的位置沿入口边缘交叉链接。

    链接必须连接不同的导航网格曲面

     

      • Agent Type – the agent type which can use the link.

      • Start Point – start point of the link, relative to the Game Object.

      • End Point – end point of the link, relative to the Game Object.

      • Align Transform To Points – clicking this button will move the Game Object at the links center point and alight the transform’s forward axis towards the end point.

      • Cost Modifier – When the cost modifier value is non-negative the cost of moving over the NavMeshLink is equivalent to the cost modifier value times the Euclidean distance between NavMeshLink end points.

      • Bidirectional – when checked the link can be traversed from start-to-end and end-to-start, when unchecked only from start-to-end.

      • Area Type – the area type of the link (affects path finding cost)

     //

      • 代理类型–代理类型,可以使用链接。

      • 起点–起点的链接,相对于游戏对象。

      • 终点–终点的链接,相对于游戏对象。

      • 对齐变换点–点击这个按钮将游戏对象的链接中心点和下车变换轴线向终点前进。

      • 成本改性剂–当成本修正值是非负的运动在navmeshlink造价相当navmeshlink端点之间的成本修饰符值倍的欧氏距离。

      • 双向–选中链接可以走过开始到结束 开始和结束当选中,只有从开始到结束

      • 区域类型–链接的区域类型(影响路径成本)

    Connecting Multiple NavMesh Surfaces Together//多个导航网格曲面连接在一起

    If it is desired to allow an agent to move along multiple NavMesh Surfaces in a Scene, the surfaces need to be connected together using NavMesh Links.

     

    In the example scene above, the blue and red NavMeshes are defined in different NavMesh Surfaces. A wide NavMesh Link is added, it spans from one surface to another.

    //

    如果需要允许代理沿着多个导航网格表面在一个场景中,表面需要连接在一起使用的导航链接。

    在上面例子中的场景,蓝色和红色navmeshes在不同的导航网格曲面。添加一个宽的导航链接,它跨越了从一个表面到另一个。

     

     

    Things to keep in mind when connecting surfaces:

      • You can connect surfaces using multiple links.

      • Both the surfaces and the link must have same agent type.

      • The link’s start and end point must be only on one surface. It is OK to have multiple NavMeshes at the same location, but then selecting a NavMesh becomes ambiguous.

      • If you are loading a second NavMesh Surface additively and you have “dangling” links in the first scene, check that they do not connect to unwanted surfaces.

     //

    当连接表面时要记住的事情:

      • 你可以使用多链路连接面。

      • 的表面和连接必须有相同的代理类型。

      • 链接的起始和结束点必须只有一个表面。它可以在同一位置有多个NavMeshes,但后来选择的导航变得模糊。

      • 如果你加载了二Navmesh表面相加,你有“悬挂”在第一幕中的链接,检查他们不要把不必要的表面。

     

    API Reference//API参考

    NavMesh Surface//导航网格表面

    Properties//性能

    • agentTypeID – ID describing the agent type the NavMesh should be built for.

    • collectObjects – defines how input geometry is collected from the scene, one of UnityEngine.AI.CollectObjects:

      • All – use all objects in the scene.

      • Volume – use all objects in the scene which touch the bounding volume (see size and center)

      • Children – use all objects which are children to the Game Object where the NavMesh Surface is attached to.

    • size – dimensions of the build volume. The size is not affected by scaling.

    • center – center of the build volume relative to the Transform center.

    • layerMask – bitmask defining the layers on which the objects must be to be included in the baking.

    • useGeometry – defined which geometry is used for baking, one of UnityEngine.AI.NavMeshCollectGeometry:

      • RenderMeshes – use geometry from render meshes and terrains

      • PhysicsColliders – use geometry from colliders and terrains.

    • defaultArea – default area type for all input geometries, unless otherwise specified

    • ignoreNavMeshAgent – true if Game Objects with a NavMeshAgent components should be ingnored as input

    • ignoreNavMeshObstacle – true if Game Objects with a NavMeshAgent components should be ingnored as input

    • overrideTileSize – true if tile size is set

    • tileSize – tile size in voxels (the component desc has explanation how to choose tile size)

    • overrideVoxelSize – true if the voxel size is set

    • voxelSize – size of the voxel in world units (the component desc has explanation how to choose tile size)

    • buildHeightMesh – Not implemented.

    • navMeshData – reference to the NavMeshData the surface uses, or null if not set.

    • activeSurfaces – list of all active NavMeshSurfaces

    Note: The above values affect how the bake results, thus, you must call BuildNavMesh() to make them count.

    //

    • agenttypeid–ID描述Agent类型导航网格应建立。

    • collectobjects–定义输入几何是从现场收集的,其中一个UnityEngine.AI.CollectObjects:

      • 全部–使用所有场景中的物体。

      • 体积–使用所有物体触摸包围盒(见大小机构

      • 儿童–使用所有对象是孩子们的游戏对象在导航网格表面附着。

    • 大小的建设量–尺寸。尺寸不受缩放。

    • 机构–的建设量相对于变换中心。

    • 图层蒙版–位掩码定义的层上的对象必须被包括在烘烤。

    • usegeometry–定义几何用于烘烤,一unityengine.ai.navmeshcollectgeometry

      • rendermeshes–使用几何渲染网格和地形

      • physicscolliders–使用几何对撞机和地形。

    • defaultarea–默认的区域类型的所有输入的几何形状,除非另有规定

    • ignorenavmeshagent如果一个–NavMeshAgent组件的游戏对象应该忽略输入

    • ignorenavmeshobstacle如果一个–NavMeshAgent组件的游戏对象应该忽略输入

    • overridetilesize–如果瓷砖尺寸设置

    • tilesize–瓷砖大小的体素(组件描述已经解释如何选择瓷砖的大小)

    • overridevoxelsize–如果像素大小设置

    • voxelsize–在世界单位像素大小(组件描述已经解释如何选择瓷砖的大小)

    • buildheightmesh–未实现。

    • navmeshdata–参照navmeshdata表面采用,或空如果没有设置。

    • activesurfaces–所有活动navmeshsurfaces列表

    注意:上述价值观如何影响烘烤的结果,因此,你必须调用buildnavmesh()让他们计数。


    Public Functions

      void BuildNavMesh ()

    Builds a new NavMeshData based on the parameters set on NavMesh Surface. The data can be accessed via navMeshData.

     //构建了一个基于参数设置对新navmeshdata导航网格表面。数据可通过navmeshdata

     

    NavMesh Modifier//导航网格修改

    Properties//性能

    • overrideArea  – true if the modifier overrides area type

    • area – new area type to apply

    • ignoreFromBuild – true if the GameObject which contains the modifier and its’ children should be not be used to NavMesh baking.

    • activeModifiers – list of all active NavMeshModifiers

    //

    • overridearea–如果改性剂覆盖区域类型

    • 区域–新区型应用

    • ignorefrombuild–如果含有改性剂及其子女不应被用来导航小游戏。

    • activemodifiers–所有活动navmeshmodifiers列表

    Public Functions

      bool AffectsAgentType(int agentTypeID)

    Returns true if the modifier applies to the specified agent type, otherwise false.

     //如果修改适用于指定的代理类型返回true,否则为false。

     

    NavMesh Modifier Volume//导航网格修正量

    Properties//性能

    • size – size of the bounding volume in local space units. Transform affects the size.

    • center – center of the bounding volume in local space units. Transform affects the center.

    • area  – area type to apply for the NavMesh areas that are inside the bounding volume.

    //

    • 大小在局部空间单位的包围–大小。变换影响的大小。

    • 机构在局部空间单位的包围–中心。变换影响中心。

    • 区域–区域类型申请,包围在导航区。

    Public Functions

      bool AffectsAgentType(int agentTypeID)

    Returns true of the the modifier applies for the specified agent type.

     //返回的修改适用于指定的代理型真。

     

    NavMesh Link//导航链接

    Properties//性能

    • agentTypeID – the type of agent that can use the link.

    • startPoint – start point of the link in local space units. Transform affects the location.

    • endPoint – end point of the link in local space units. Transform affects the location.

    • width – width of the link in world length units.

    • costModifier – when the cost modifier value is non-negative the cost of moving over the NavMeshLink is equivalent to the cost modifier value times the Euclidean distance between NavMeshLink end points.

    • bidirectional – if true the link can be traversed both ways, if false the link can be traversed only from start to end.

    • autoUpdate – if true the link updates the endpoints to follow the transform of the GameObject every frame.

    • area  – area type of the link (used for pathfinding cost).

    //

    • agenttypeid–代理的类型,可以使用链接。

    • 起点在局部空间单元的链接–起点。变换位置的影响。

    • 端点在局部空间单元的链接–终点。变换位置的影响。

    • 宽度在世界的联系–宽度长度单位。

    • costmodifier–当成本修正值是非负的运动在navmeshlink造价相当navmeshlink端点之间的成本修饰符值倍的欧氏距离。

    • 双向如果真的–链接可以遍历两边,如果虚假链接可以遍历从开始到结束。

    • 自动更新如果真的–链接更新端点遵循变换游戏物体的每一帧。

    • 区域–区域类型的链接(用于寻路的成本)。

     

    Public Functions

      void UpdateLink()

    Updates the link to match the associated transform. This is useful for updating a link explicitly after e.g. changing the transform position. It is not necessary if the autoUpdate property is enabled. However calling UpdateLink can have a much smaller performance impact if you rarely change the link transform.

     //

    更新链接匹配相关的变换。这个更新链接明确后如改变变换位置是有用的。这是没有必要的如果自动更新属性启用。但是打电话updatelink可以有一个更小的性能的影响如果你很少改变链接变换。

     

  • 相关阅读:
    投票系统完善
    投票系统设计与实现
    一天天进步
    洛谷P4168 [Violet]蒲公英 题解 数列分块
    LOJ6285. 数列分块入门 9 题解
    洛谷P5340 大中锋的游乐场 题解 分层图最短路
    P1073 [NOIP2009 提高组] 最优贸易 题解 分层图最短路
    洛谷P7297 [USACO21JAN] Telephone G 题解 分层图最短路
    洛谷P1119 灾后重建 题解 Floyd算法
    安装redis 后本地系统空间越来越小
  • 原文地址:https://www.cnblogs.com/jiangshuai52511/p/6741946.html
Copyright © 2011-2022 走看看