mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
Don't use SceneTree when not referring to the class
This commit is contained in:
@@ -35,7 +35,7 @@ The same approach can be used to distinguish between e.g. landwalking, swimming
|
||||
# Create the source geometry resource that will hold the parsed geometry data.
|
||||
var source_geometry_data: NavigationMeshSourceGeometryData3D = NavigationMeshSourceGeometryData3D.new()
|
||||
|
||||
# Parse the source geometry from the SceneTree on the main thread.
|
||||
# Parse the source geometry from the scene tree on the main thread.
|
||||
# The navigation mesh is only required for the parse settings so any of the three will do.
|
||||
NavigationServer3D.parse_source_geometry_data(navigation_mesh_standard_size, source_geometry_data, root_node)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ Godot provides the following objects and classes for 2D navigation:
|
||||
- NavObstacle RID
|
||||
Reference to a specific avoidance obstacle used to affect and constrain the avoidance velocity of agents.
|
||||
|
||||
The following SceneTree Nodes are available as helpers to work with the NavigationServer2D API.
|
||||
The following scene tree nodes are available as helpers to work with the NavigationServer2D API.
|
||||
|
||||
- :ref:`NavigationRegion2D<class_NavigationRegion2D>` Node
|
||||
A Node that holds a NavigationPolygon resource that defines a navigation mesh for the NavigationServer2D.
|
||||
|
||||
@@ -39,7 +39,7 @@ Godot provides the following objects and classes for 3D navigation:
|
||||
- NavObstacle RID
|
||||
Reference to a specific avoidance obstacle used to affect and constrain the avoidance velocity of agents.
|
||||
|
||||
The following SceneTree Nodes are available as helpers to work with the NavigationServer3D API.
|
||||
The following scene tree nodes are available as helpers to work with the NavigationServer3D API.
|
||||
|
||||
- :ref:`NavigationRegion3D<class_NavigationRegion3D>` Node
|
||||
A Node that holds a Navigation Mesh resource that defines a navigation mesh for the NavigationServer3D.
|
||||
|
||||
@@ -7,7 +7,7 @@ Optimizing Navigation Performance
|
||||
|
||||
Common Navigation related performance problems can be categorized into the following topics:
|
||||
|
||||
- Performance problems with parsing SceneTree nodes for navigation mesh baking.
|
||||
- Performance problems with parsing scene tree nodes for navigation mesh baking.
|
||||
- Performance problems with baking the actual navigation mesh.
|
||||
- Performance problems with NavigationAgent path queries.
|
||||
- Performance problems with the actual path search.
|
||||
@@ -15,8 +15,8 @@ Common Navigation related performance problems can be categorized into the follo
|
||||
|
||||
In the following sections information can be found on how to identify and fix or at least mitigate their impact on framerates.
|
||||
|
||||
Performance problems with parsing SceneTree nodes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Performance problems with parsing scene tree nodes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. tip::
|
||||
|
||||
@@ -50,7 +50,7 @@ Performance problems with navigation mesh baking
|
||||
|
||||
Baking navigation meshes at runtime should always be done in a background thread if possible. Even small sized navigation meshes can take far longer to bake than what is possible to squeeze into a single frame, at least if the framerate should stay at a bearable level.
|
||||
|
||||
Complexity of source geometry data parsed from SceneTree nodes has big impact on baking performance as everything needs to be mapped to a grid / voxels.
|
||||
Complexity of source geometry data parsed from scene tree nodes has big impact on baking performance as everything needs to be mapped to a grid / voxels.
|
||||
For runtime baking performance the NavigationMesh cell size and cell height should be set as high as possible without causing navigation mesh quality problems for a game.
|
||||
If cell size or cell height is set too low the baking is forced to create an excessive amount of voxels to process the source geometry.
|
||||
If the source geometry spans over a very large game world it is even possible that the baking process runs out off memory in the middle and crashes the game.
|
||||
|
||||
@@ -12,7 +12,7 @@ and :ref:`NavigationRegion3D<class_NavigationRegion3D>` respectively.
|
||||
Individual NavigationRegions upload their 2D NavigationPolygon or 3D NavigationMesh resource data to the NavigationServer.
|
||||
The NavigationServer map turns this information into a combined navigation map for pathfinding.
|
||||
|
||||
To create a navigation region using the SceneTree add a ``NavigationRegion2D`` or ``NavigationRegion3D`` node to the scene.
|
||||
To create a navigation region using the scene tree add a ``NavigationRegion2D`` or ``NavigationRegion3D`` node to the scene.
|
||||
All regions require a navigation mesh resource to function. See :ref:`doc_navigation_using_navigationmeshes` to learn how to create and apply navigation meshes.
|
||||
|
||||
NavigationRegions will automatically push ``global_transform`` changes to the region on the NavigationServer which makes them suitable for moving platforms.
|
||||
|
||||
@@ -16,7 +16,7 @@ Communicating with the NavigationServer
|
||||
To work with the NavigationServer means to prepare parameters for a ``query`` that can be send to the NavigationServer for updates or requesting data.
|
||||
|
||||
To reference the internal NavigationServer objects like maps, regions and agents RIDs are used as identification numbers.
|
||||
Every navigation related node in the SceneTree has a function that returns the RID for this node.
|
||||
Every navigation related node in the scene tree has a function that returns the RID for this node.
|
||||
|
||||
Threading and Synchronization
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -39,7 +39,7 @@ Synchronization for the NavigationServer happens in the middle of the physics fr
|
||||
|
||||
.. note::
|
||||
The important takeaway is that most NavigationServer changes take effect after the next physics frame and not immediately.
|
||||
This includes all changes made by navigation related nodes in the SceneTree or through scripts.
|
||||
This includes all changes made by navigation related nodes in the scene tree or through scripts.
|
||||
|
||||
The following functions will be executed in the synchronization phase only:
|
||||
|
||||
@@ -103,7 +103,7 @@ Waiting for synchronization
|
||||
At the start of the game, a new scene or procedural navigation changes any path query to a NavigationServer will return empty or wrong.
|
||||
|
||||
The navigation map is still empty or not updated at this point.
|
||||
All nodes from the SceneTree need to first upload their navigation related data to the NavigationServer.
|
||||
All nodes from the scene tree need to first upload their navigation related data to the NavigationServer.
|
||||
Each added or changed map, region or agent need to be registered with the NavigationServer.
|
||||
Afterward the NavigationServer requires a ``physics_frame`` for synchronization to update the maps, regions and agents.
|
||||
|
||||
@@ -117,7 +117,7 @@ Afterwards the function waits for the next physics_frame before continuing with
|
||||
extends Node3D
|
||||
|
||||
func _ready():
|
||||
# use call deferred to make sure the entire SceneTree Nodes are setup
|
||||
# use call deferred to make sure the entire scene tree nodes are setup
|
||||
# else await / yield on 'physics_frame' in a _ready() might get stuck
|
||||
call_deferred("custom_setup")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user