Files
godot-docs-l10n/classes/zh_CN/class_navigationpathqueryparameters2d.rst

328 lines
15 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/NavigationPathQueryParameters2D.xml.
.. _class_NavigationPathQueryParameters2D:
NavigationPathQueryParameters2D
===============================
**实验性:** This class may be changed or removed in future versions.
**继承:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
为 2D 导航路径查询提供参数。
.. rst-class:: classref-introduction-group
描述
----
更改该对象的起始和结束位置等属性可以配置对 :ref:`NavigationServer2D<class_NavigationServer2D>` 的路径查询。
.. rst-class:: classref-introduction-group
教程
----
- :doc:`使用 NavigationPathQueryObject <../tutorials/navigation/navigation_using_navigationpathqueryobjects>`
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`RID<class_RID>` | :ref:`map<class_NavigationPathQueryParameters2D_property_map>` | ``RID()`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>`\] | :ref:`metadata_flags<class_NavigationPathQueryParameters2D_property_metadata_flags>` | ``7`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationPathQueryParameters2D_property_navigation_layers>` | ``1`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`PathPostProcessing<enum_NavigationPathQueryParameters2D_PathPostProcessing>` | :ref:`path_postprocessing<class_NavigationPathQueryParameters2D_property_path_postprocessing>` | ``0`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters2D_PathfindingAlgorithm>` | :ref:`pathfinding_algorithm<class_NavigationPathQueryParameters2D_property_pathfinding_algorithm>` | ``0`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`simplify_epsilon<class_NavigationPathQueryParameters2D_property_simplify_epsilon>` | ``0.0`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`simplify_path<class_NavigationPathQueryParameters2D_property_simplify_path>` | ``false`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`start_position<class_NavigationPathQueryParameters2D_property_start_position>` | ``Vector2(0, 0)`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`target_position<class_NavigationPathQueryParameters2D_property_target_position>` | ``Vector2(0, 0)`` |
+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
枚举
----
.. _enum_NavigationPathQueryParameters2D_PathfindingAlgorithm:
.. rst-class:: classref-enumeration
enum **PathfindingAlgorithm**: :ref:`🔗<enum_NavigationPathQueryParameters2D_PathfindingAlgorithm>`
.. _class_NavigationPathQueryParameters2D_constant_PATHFINDING_ALGORITHM_ASTAR:
.. rst-class:: classref-enumeration-constant
:ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters2D_PathfindingAlgorithm>` **PATHFINDING_ALGORITHM_ASTAR** = ``0``
路径查询使用默认的 A\* 寻路算法。
.. rst-class:: classref-item-separator
----
.. _enum_NavigationPathQueryParameters2D_PathPostProcessing:
.. rst-class:: classref-enumeration
enum **PathPostProcessing**: :ref:`🔗<enum_NavigationPathQueryParameters2D_PathPostProcessing>`
.. _class_NavigationPathQueryParameters2D_constant_PATH_POSTPROCESSING_CORRIDORFUNNEL:
.. rst-class:: classref-enumeration-constant
:ref:`PathPostProcessing<enum_NavigationPathQueryParameters2D_PathPostProcessing>` **PATH_POSTPROCESSING_CORRIDORFUNNEL** = ``0``
将漏斗算法应用于寻路算法找到的原始路径走廊。这将导致最短路径可能在路径走廊内。该后处理在很大程度上取决于导航网格多边形布局和创建的走廊。特别是基于图块和网格的布局,可能会由于单元格形状强加的锯齿状的路径走廊,而面临对角线移动的人工角落。
.. _class_NavigationPathQueryParameters2D_constant_PATH_POSTPROCESSING_EDGECENTERED:
.. rst-class:: classref-enumeration-constant
:ref:`PathPostProcessing<enum_NavigationPathQueryParameters2D_PathPostProcessing>` **PATH_POSTPROCESSING_EDGECENTERED** = ``1``
将路径上的所有位置在经过的导航网格多边形边缘上居中。这样就把移动限制在了单元格的中心,能够为基于图块或栅格的布局创建更好的路径。
.. rst-class:: classref-item-separator
----
.. _enum_NavigationPathQueryParameters2D_PathMetadataFlags:
.. rst-class:: classref-enumeration
flags **PathMetadataFlags**: :ref:`🔗<enum_NavigationPathQueryParameters2D_PathMetadataFlags>`
.. _class_NavigationPathQueryParameters2D_constant_PATH_METADATA_INCLUDE_NONE:
.. rst-class:: classref-enumeration-constant
:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>` **PATH_METADATA_INCLUDE_NONE** = ``0``
不要包含任何关于返回路径的额外元数据。
.. _class_NavigationPathQueryParameters2D_constant_PATH_METADATA_INCLUDE_TYPES:
.. rst-class:: classref-enumeration-constant
:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>` **PATH_METADATA_INCLUDE_TYPES** = ``1``
包含路径上的各个点所经过的导航图元类型(地区或链接)。
.. _class_NavigationPathQueryParameters2D_constant_PATH_METADATA_INCLUDE_RIDS:
.. rst-class:: classref-enumeration-constant
:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>` **PATH_METADATA_INCLUDE_RIDS** = ``2``
包含路径上的各个点所经过的地区和链接的 :ref:`RID<class_RID>`\ 。
.. _class_NavigationPathQueryParameters2D_constant_PATH_METADATA_INCLUDE_OWNERS:
.. rst-class:: classref-enumeration-constant
:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>` **PATH_METADATA_INCLUDE_OWNERS** = ``4``
包含管理路径上的各个点所经过的地区和链接的 :ref:`Object<class_Object>```ObjectID``\ 。
.. _class_NavigationPathQueryParameters2D_constant_PATH_METADATA_INCLUDE_ALL:
.. rst-class:: classref-enumeration-constant
:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>` **PATH_METADATA_INCLUDE_ALL** = ``7``
包含关于返回路径的所有可用元数据。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_NavigationPathQueryParameters2D_property_map:
.. rst-class:: classref-property
:ref:`RID<class_RID>` **map** = ``RID()`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_map>`
.. rst-class:: classref-property-setget
- |void| **set_map**\ (\ value\: :ref:`RID<class_RID>`\ )
- :ref:`RID<class_RID>` **get_map**\ (\ )
在路径查询中使用的导航地图 :ref:`RID<class_RID>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_metadata_flags:
.. rst-class:: classref-property
|bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>`\] **metadata_flags** = ``7`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_metadata_flags>`
.. rst-class:: classref-property-setget
- |void| **set_metadata_flags**\ (\ value\: |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>`\]\ )
- |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters2D_PathMetadataFlags>`\] **get_metadata_flags**\ (\ )
包含在导航路径中的额外信息。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_navigation_layers:
.. rst-class:: classref-property
:ref:`int<class_int>` **navigation_layers** = ``1`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_navigation_layers>`
.. rst-class:: classref-property-setget
- |void| **set_navigation_layers**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_navigation_layers**\ (\ )
查询所使用的导航层(形式为位掩码)。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_path_postprocessing:
.. rst-class:: classref-property
:ref:`PathPostProcessing<enum_NavigationPathQueryParameters2D_PathPostProcessing>` **path_postprocessing** = ``0`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_path_postprocessing>`
.. rst-class:: classref-property-setget
- |void| **set_path_postprocessing**\ (\ value\: :ref:`PathPostProcessing<enum_NavigationPathQueryParameters2D_PathPostProcessing>`\ )
- :ref:`PathPostProcessing<enum_NavigationPathQueryParameters2D_PathPostProcessing>` **get_path_postprocessing**\ (\ )
:ref:`pathfinding_algorithm<class_NavigationPathQueryParameters2D_property_pathfinding_algorithm>` 找到的原始路径走廊应用的路径后期处理。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_pathfinding_algorithm:
.. rst-class:: classref-property
:ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters2D_PathfindingAlgorithm>` **pathfinding_algorithm** = ``0`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_pathfinding_algorithm>`
.. rst-class:: classref-property-setget
- |void| **set_pathfinding_algorithm**\ (\ value\: :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters2D_PathfindingAlgorithm>`\ )
- :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters2D_PathfindingAlgorithm>` **get_pathfinding_algorithm**\ (\ )
路径查询中使用的寻路算法。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_simplify_epsilon:
.. rst-class:: classref-property
:ref:`float<class_float>` **simplify_epsilon** = ``0.0`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_simplify_epsilon>`
.. rst-class:: classref-property-setget
- |void| **set_simplify_epsilon**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_simplify_epsilon**\ (\ )
以世界单位表示的路径简化量。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_simplify_path:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **simplify_path** = ``false`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_simplify_path>`
.. rst-class:: classref-property-setget
- |void| **set_simplify_path**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_simplify_path**\ (\ )
如果为 ``true``\ ,将返回路径的简化版本,其中移除了不太重要的路径点。简化量由 :ref:`simplify_epsilon<class_NavigationPathQueryParameters2D_property_simplify_epsilon>` 控制。简化使用 Ramer-Douglas-Peucker 算法的变体进行曲线点抽取。
路径简化有助于缓解使用某些代理类型和脚本行为可能出现的各种路径跟踪问题。例如“开放场”中的“转向”代理或避让。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_start_position:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **start_position** = ``Vector2(0, 0)`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_start_position>`
.. rst-class:: classref-property-setget
- |void| **set_start_position**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_start_position**\ (\ )
寻路起始点,使用全局坐标。
.. rst-class:: classref-item-separator
----
.. _class_NavigationPathQueryParameters2D_property_target_position:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **target_position** = ``Vector2(0, 0)`` :ref:`🔗<class_NavigationPathQueryParameters2D_property_target_position>`
.. rst-class:: classref-property-setget
- |void| **set_target_position**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_target_position**\ (\ )
寻路目标点,使用全局坐标。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`