Class NavigationServer2DInstance
- Namespace
- Godot
- Assembly
- GodotSharp.dll
NavigationServer2D is the server that handles navigation maps, regions and agents. It does not handle A* navigation from AStar2D or AStarGrid2D.
Maps are made up of regions, which are made of navigation polygons. Together, they define the traversable areas in the 2D world.
Note: Most NavigationServer2D changes take effect after the next physics frame and not immediately. This includes all changes made to maps, regions or agents by navigation-related nodes in the scene tree or made through scripts.
For two regions to be connected to each other, they must share a similar edge. An edge is considered connected to another if both of its two vertices are at a distance less than edge_connection_margin
to the respective other edge's vertex.
You may assign navigation layers to regions with RegionSetNavigationLayers(Rid, uint), which then can be checked upon when requesting a path with MapGetPath(Rid, Vector2, Vector2, bool, uint). This can be used to allow or deny certain areas for some objects.
To use the collision avoidance system, you may use agents. You can set an agent's target velocity, then the servers will emit a callback with a modified velocity.
Note: The collision avoidance system ignores regions. Using the modified velocity directly may move an agent outside of the traversable area. This is a limitation of the collision avoidance system, any more complex situation may require the use of the physics engine.
This server keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.
[GodotClassName("NavigationServer2D")]
public class NavigationServer2DInstance : GodotObject, IDisposable
- Inheritance
-
NavigationServer2DInstance
- Implements
- Inherited Members
Methods
AgentCreate()
Creates the agent.
public Rid AgentCreate()
Returns
AgentGetAvoidanceEnabled(Rid)
Return true
if the specified agent
uses avoidance.
public bool AgentGetAvoidanceEnabled(Rid agent)
Parameters
agent
Rid
Returns
AgentGetMap(Rid)
Returns the navigation map Rid the requested agent
is currently assigned to.
public Rid AgentGetMap(Rid agent)
Parameters
agent
Rid
Returns
AgentGetPaused(Rid)
Returns true
if the specified agent
is paused.
public bool AgentGetPaused(Rid agent)
Parameters
agent
Rid
Returns
AgentIsMapChanged(Rid)
Returns true if the map got changed the previous frame.
public bool AgentIsMapChanged(Rid agent)
Parameters
agent
Rid
Returns
AgentSetAvoidanceCallback(Rid, Callable)
Sets the callback Callable that gets called after each avoidance processing step for the agent
. The calculated safe_velocity
will be dispatched with a signal to the object just before the physics calculations.
Note: Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use AgentSetAvoidanceCallback(Rid, Callable) again with an empty Callable.
public void AgentSetAvoidanceCallback(Rid agent, Callable callback)
Parameters
AgentSetAvoidanceEnabled(Rid, bool)
If enabled
is true
, the specified agent
uses avoidance.
public void AgentSetAvoidanceEnabled(Rid agent, bool enabled)
Parameters
AgentSetAvoidanceLayers(Rid, uint)
Set the agent's avoidance_layers
bitmask.
public void AgentSetAvoidanceLayers(Rid agent, uint layers)
Parameters
AgentSetAvoidanceMask(Rid, uint)
Set the agent's avoidance_mask
bitmask.
public void AgentSetAvoidanceMask(Rid agent, uint mask)
Parameters
AgentSetAvoidancePriority(Rid, float)
Set the agent's avoidance_priority
with a priority
between 0.0 (lowest priority) to 1.0 (highest priority).
The specified agent
does not adjust the velocity for other agents that would match the avoidance_mask
but have a lower avoidance_priority
. This in turn makes the other agents with lower priority adjust their velocities even more to avoid collision with this agent.
public void AgentSetAvoidancePriority(Rid agent, float priority)
Parameters
AgentSetMap(Rid, Rid)
Puts the agent in the map.
public void AgentSetMap(Rid agent, Rid map)
Parameters
AgentSetMaxNeighbors(Rid, int)
Sets the maximum number of other agents the agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
public void AgentSetMaxNeighbors(Rid agent, int count)
Parameters
AgentSetMaxSpeed(Rid, float)
Sets the maximum speed of the agent. Must be positive.
public void AgentSetMaxSpeed(Rid agent, float maxSpeed)
Parameters
AgentSetNeighborDistance(Rid, float)
Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
public void AgentSetNeighborDistance(Rid agent, float distance)
Parameters
AgentSetPaused(Rid, bool)
If paused
is true the specified agent
will not be processed, e.g. calculate avoidance velocities or receive avoidance callbacks.
public void AgentSetPaused(Rid agent, bool paused)
Parameters
AgentSetPosition(Rid, Vector2)
Sets the position of the agent in world space.
public void AgentSetPosition(Rid agent, Vector2 position)
Parameters
AgentSetRadius(Rid, float)
Sets the radius of the agent.
public void AgentSetRadius(Rid agent, float radius)
Parameters
AgentSetTimeHorizonAgents(Rid, float)
The minimal amount of time for which the agent's velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner this agent will respond to the presence of other agents, but the less freedom this agent has in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.
public void AgentSetTimeHorizonAgents(Rid agent, float timeHorizon)
Parameters
AgentSetTimeHorizonObstacles(Rid, float)
The minimal amount of time for which the agent's velocities that are computed by the simulation are safe with respect to static avoidance obstacles. The larger this number, the sooner this agent will respond to the presence of static avoidance obstacles, but the less freedom this agent has in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.
public void AgentSetTimeHorizonObstacles(Rid agent, float timeHorizon)
Parameters
AgentSetVelocity(Rid, Vector2)
Sets velocity
as the new wanted velocity for the specified agent
. The avoidance simulation will try to fulfill this velocity if possible but will modify it to avoid collision with other agent's and obstacles. When an agent is teleported to a new position far away use AgentSetVelocityForced(Rid, Vector2) instead to reset the internal velocity state.
public void AgentSetVelocity(Rid agent, Vector2 velocity)
Parameters
AgentSetVelocityForced(Rid, Vector2)
Replaces the internal velocity in the collision avoidance simulation with velocity
for the specified agent
. When an agent is teleported to a new position far away this function should be used in the same frame. If called frequently this function can get agents stuck.
public void AgentSetVelocityForced(Rid agent, Vector2 velocity)
Parameters
BakeFromSourceGeometryData(NavigationPolygon, NavigationMeshSourceGeometryData2D, Callable)
Bakes the provided navigationPolygon
with the data from the provided sourceGeometryData
. After the process is finished the optional callback
will be called.
public void BakeFromSourceGeometryData(NavigationPolygon navigationPolygon, NavigationMeshSourceGeometryData2D sourceGeometryData, Callable callback = default)
Parameters
navigationPolygon
NavigationPolygonsourceGeometryData
NavigationMeshSourceGeometryData2Dcallback
Callable
BakeFromSourceGeometryDataAsync(NavigationPolygon, NavigationMeshSourceGeometryData2D, Callable)
Bakes the provided navigationPolygon
with the data from the provided sourceGeometryData
as an async task running on a background thread. After the process is finished the optional callback
will be called.
public void BakeFromSourceGeometryDataAsync(NavigationPolygon navigationPolygon, NavigationMeshSourceGeometryData2D sourceGeometryData, Callable callback = default)
Parameters
navigationPolygon
NavigationPolygonsourceGeometryData
NavigationMeshSourceGeometryData2Dcallback
Callable
FreeRid(Rid)
Destroys the given RID.
public void FreeRid(Rid rid)
Parameters
rid
Rid
GetDebugEnabled()
Returns true
when the NavigationServer has debug enabled.
public bool GetDebugEnabled()
Returns
GetMaps()
Returns all created navigation map Rids on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them.
public Array<Rid> GetMaps()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
LinkCreate()
Create a new link between two positions on a map.
public Rid LinkCreate()
Returns
LinkGetEnabled(Rid)
Returns true
if the specified link
is enabled.
public bool LinkGetEnabled(Rid link)
Parameters
link
Rid
Returns
LinkGetEndPosition(Rid)
Returns the ending position of this link
.
public Vector2 LinkGetEndPosition(Rid link)
Parameters
link
Rid
Returns
LinkGetEnterCost(Rid)
Returns the enter cost of this link
.
public float LinkGetEnterCost(Rid link)
Parameters
link
Rid
Returns
LinkGetMap(Rid)
Returns the navigation map Rid the requested link
is currently assigned to.
public Rid LinkGetMap(Rid link)
Parameters
link
Rid
Returns
LinkGetNavigationLayers(Rid)
Returns the navigation layers for this link
.
public uint LinkGetNavigationLayers(Rid link)
Parameters
link
Rid
Returns
LinkGetOwnerId(Rid)
Returns the ObjectID
of the object which manages this link.
public ulong LinkGetOwnerId(Rid link)
Parameters
link
Rid
Returns
LinkGetStartPosition(Rid)
Returns the starting position of this link
.
public Vector2 LinkGetStartPosition(Rid link)
Parameters
link
Rid
Returns
LinkGetTravelCost(Rid)
Returns the travel cost of this link
.
public float LinkGetTravelCost(Rid link)
Parameters
link
Rid
Returns
LinkIsBidirectional(Rid)
Returns whether this link
can be travelled in both directions.
public bool LinkIsBidirectional(Rid link)
Parameters
link
Rid
Returns
LinkSetBidirectional(Rid, bool)
Sets whether this link
can be travelled in both directions.
public void LinkSetBidirectional(Rid link, bool bidirectional)
Parameters
LinkSetEnabled(Rid, bool)
If enabled
is true
, the specified link
will contribute to its current navigation map.
public void LinkSetEnabled(Rid link, bool enabled)
Parameters
LinkSetEndPosition(Rid, Vector2)
Sets the exit position for the link
.
public void LinkSetEndPosition(Rid link, Vector2 position)
Parameters
LinkSetEnterCost(Rid, float)
Sets the enterCost
for this link
.
public void LinkSetEnterCost(Rid link, float enterCost)
Parameters
LinkSetMap(Rid, Rid)
Sets the navigation map Rid for the link.
public void LinkSetMap(Rid link, Rid map)
Parameters
LinkSetNavigationLayers(Rid, uint)
Set the links's navigation layers. This allows selecting links from a path request (when using MapGetPath(Rid, Vector2, Vector2, bool, uint)).
public void LinkSetNavigationLayers(Rid link, uint navigationLayers)
Parameters
LinkSetOwnerId(Rid, ulong)
Set the ObjectID
of the object which manages this link.
public void LinkSetOwnerId(Rid link, ulong ownerId)
Parameters
LinkSetStartPosition(Rid, Vector2)
Sets the entry position for this link
.
public void LinkSetStartPosition(Rid link, Vector2 position)
Parameters
LinkSetTravelCost(Rid, float)
Sets the travelCost
for this link
.
public void LinkSetTravelCost(Rid link, float travelCost)
Parameters
MapCreate()
Create a new map.
public Rid MapCreate()
Returns
MapForceUpdate(Rid)
This function immediately forces synchronization of the specified navigation map
Rid. By default navigation maps are only synchronized at the end of each physics frame. This function can be used to immediately (re)calculate all the navigation meshes and region connections of the navigation map. This makes it possible to query a navigation path for a changed map immediately and in the same frame (multiple times if needed).
Due to technical restrictions the current NavigationServer command queue will be flushed. This means all already queued update commands for this physics frame will be executed, even those intended for other maps, regions and agents not part of the specified map. The expensive computation of the navigation meshes and region connections of a map will only be done for the specified map. Other maps will receive the normal synchronization at the end of the physics frame. Should the specified map receive changes after the forced update it will update again as well when the other maps receive their update.
Avoidance processing and dispatch of the safe_velocity
signals is unaffected by this function and continues to happen for all maps and agents at the end of the physics frame.
Note: With great power comes great responsibility. This function should only be used by users that really know what they are doing and have a good reason for it. Forcing an immediate update of a navigation map requires locking the NavigationServer and flushing the entire NavigationServer command queue. Not only can this severely impact the performance of a game but it can also introduce bugs if used inappropriately without much foresight.
public void MapForceUpdate(Rid map)
Parameters
map
Rid
MapGetAgents(Rid)
Returns all navigation agents Rids that are currently assigned to the requested navigation map
.
public Array<Rid> MapGetAgents(Rid map)
Parameters
map
Rid
Returns
MapGetCellSize(Rid)
Returns the map cell size used to rasterize the navigation mesh vertices.
public float MapGetCellSize(Rid map)
Parameters
map
Rid
Returns
MapGetClosestPoint(Rid, Vector2)
Returns the point closest to the provided toPoint
on the navigation mesh surface.
public Vector2 MapGetClosestPoint(Rid map, Vector2 toPoint)
Parameters
Returns
MapGetClosestPointOwner(Rid, Vector2)
Returns the owner region RID for the point returned by MapGetClosestPoint(Rid, Vector2).
public Rid MapGetClosestPointOwner(Rid map, Vector2 toPoint)
Parameters
Returns
MapGetEdgeConnectionMargin(Rid)
Returns the edge connection margin of the map. The edge connection margin is a distance used to connect two regions.
public float MapGetEdgeConnectionMargin(Rid map)
Parameters
map
Rid
Returns
MapGetLinkConnectionRadius(Rid)
Returns the link connection radius of the map. This distance is the maximum range any link will search for navigation mesh polygons to connect to.
public float MapGetLinkConnectionRadius(Rid map)
Parameters
map
Rid
Returns
MapGetLinks(Rid)
Returns all navigation link Rids that are currently assigned to the requested navigation map
.
public Array<Rid> MapGetLinks(Rid map)
Parameters
map
Rid
Returns
MapGetObstacles(Rid)
Returns all navigation obstacle Rids that are currently assigned to the requested navigation map
.
public Array<Rid> MapGetObstacles(Rid map)
Parameters
map
Rid
Returns
MapGetPath(Rid, Vector2, Vector2, bool, uint)
Returns the navigation path to reach the destination from the origin. navigationLayers
is a bitmask of all region navigation layers that are allowed to be in the path.
public Vector2[] MapGetPath(Rid map, Vector2 origin, Vector2 destination, bool optimize, uint navigationLayers = 1)
Parameters
Returns
- Vector2[]
MapGetRegions(Rid)
Returns all navigation regions Rids that are currently assigned to the requested navigation map
.
public Array<Rid> MapGetRegions(Rid map)
Parameters
map
Rid
Returns
MapGetUseEdgeConnections(Rid)
Returns whether the navigation map
allows navigation regions to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
public bool MapGetUseEdgeConnections(Rid map)
Parameters
map
Rid
Returns
MapIsActive(Rid)
Returns true if the map is active.
public bool MapIsActive(Rid map)
Parameters
map
Rid
Returns
MapSetActive(Rid, bool)
Sets the map active.
public void MapSetActive(Rid map, bool active)
Parameters
MapSetCellSize(Rid, float)
Sets the map cell size used to rasterize the navigation mesh vertices. Must match with the cell size of the used navigation meshes.
public void MapSetCellSize(Rid map, float cellSize)
Parameters
MapSetEdgeConnectionMargin(Rid, float)
Set the map edge connection margin used to weld the compatible region edges.
public void MapSetEdgeConnectionMargin(Rid map, float margin)
Parameters
MapSetLinkConnectionRadius(Rid, float)
Set the map's link connection radius used to connect links to navigation polygons.
public void MapSetLinkConnectionRadius(Rid map, float radius)
Parameters
MapSetUseEdgeConnections(Rid, bool)
Set the navigation map
edge connection use. If enabled
is true
, the navigation map allows navigation regions to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
public void MapSetUseEdgeConnections(Rid map, bool enabled)
Parameters
ObstacleCreate()
Creates a new navigation obstacle.
public Rid ObstacleCreate()
Returns
ObstacleGetAvoidanceEnabled(Rid)
Returns true
if the provided obstacle
has avoidance enabled.
public bool ObstacleGetAvoidanceEnabled(Rid obstacle)
Parameters
obstacle
Rid
Returns
ObstacleGetMap(Rid)
Returns the navigation map Rid the requested obstacle
is currently assigned to.
public Rid ObstacleGetMap(Rid obstacle)
Parameters
obstacle
Rid
Returns
ObstacleGetPaused(Rid)
Returns true
if the specified obstacle
is paused.
public bool ObstacleGetPaused(Rid obstacle)
Parameters
obstacle
Rid
Returns
ObstacleSetAvoidanceEnabled(Rid, bool)
If enabled
is true
, the provided obstacle
affects avoidance using agents.
public void ObstacleSetAvoidanceEnabled(Rid obstacle, bool enabled)
Parameters
ObstacleSetAvoidanceLayers(Rid, uint)
Set the obstacles's avoidance_layers
bitmask.
public void ObstacleSetAvoidanceLayers(Rid obstacle, uint layers)
Parameters
ObstacleSetMap(Rid, Rid)
Sets the navigation map Rid for the obstacle.
public void ObstacleSetMap(Rid obstacle, Rid map)
Parameters
ObstacleSetPaused(Rid, bool)
If paused
is true the specified obstacle
will not be processed, e.g. affect avoidance velocities.
public void ObstacleSetPaused(Rid obstacle, bool paused)
Parameters
ObstacleSetPosition(Rid, Vector2)
Sets the position of the obstacle in world space.
public void ObstacleSetPosition(Rid obstacle, Vector2 position)
Parameters
ObstacleSetRadius(Rid, float)
Sets the radius of the dynamic obstacle.
public void ObstacleSetRadius(Rid obstacle, float radius)
Parameters
ObstacleSetVelocity(Rid, Vector2)
Sets velocity
of the dynamic obstacle
. Allows other agents to better predict the movement of the dynamic obstacle. Only works in combination with the radius of the obstacle.
public void ObstacleSetVelocity(Rid obstacle, Vector2 velocity)
Parameters
ObstacleSetVertices(Rid, Vector2[])
Sets the outline vertices for the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out.
public void ObstacleSetVertices(Rid obstacle, Vector2[] vertices)
Parameters
ParseSourceGeometryData(NavigationPolygon, NavigationMeshSourceGeometryData2D, Node, Callable)
Parses the SceneTree for source geometry according to the properties of navigationPolygon
. Updates the provided sourceGeometryData
resource with the resulting data. The resource can then be used to bake a navigation mesh with BakeFromSourceGeometryData(NavigationPolygon, NavigationMeshSourceGeometryData2D, Callable). After the process is finished the optional callback
will be called.
Note: This function needs to run on the main thread or with a deferred call as the SceneTree is not thread-safe.
Performance: While convenient, reading data arrays from Mesh resources can affect the frame rate negatively. The data needs to be received from the GPU, stalling the RenderingServer in the process. For performance prefer the use of e.g. collision shapes or creating the data arrays entirely in code.
public void ParseSourceGeometryData(NavigationPolygon navigationPolygon, NavigationMeshSourceGeometryData2D sourceGeometryData, Node rootNode, Callable callback = default)
Parameters
navigationPolygon
NavigationPolygonsourceGeometryData
NavigationMeshSourceGeometryData2DrootNode
Nodecallback
Callable
QueryPath(NavigationPathQueryParameters2D, NavigationPathQueryResult2D)
Queries a path in a given navigation map. Start and target position and other parameters are defined through NavigationPathQueryParameters2D. Updates the provided NavigationPathQueryResult2D result object with the path among other results requested by the query.
public void QueryPath(NavigationPathQueryParameters2D parameters, NavigationPathQueryResult2D result)
Parameters
parameters
NavigationPathQueryParameters2Dresult
NavigationPathQueryResult2D
RegionCreate()
Creates a new region.
public Rid RegionCreate()
Returns
RegionGetConnectionPathwayEnd(Rid, int)
Returns the ending point of a connection door. connection
is an index between 0 and the return value of RegionGetConnectionsCount(Rid).
public Vector2 RegionGetConnectionPathwayEnd(Rid region, int connection)
Parameters
Returns
RegionGetConnectionPathwayStart(Rid, int)
Returns the starting point of a connection door. connection
is an index between 0 and the return value of RegionGetConnectionsCount(Rid).
public Vector2 RegionGetConnectionPathwayStart(Rid region, int connection)
Parameters
Returns
RegionGetConnectionsCount(Rid)
Returns how many connections this region
has with other regions in the map.
public int RegionGetConnectionsCount(Rid region)
Parameters
region
Rid
Returns
RegionGetEnabled(Rid)
Returns true
if the specified region
is enabled.
public bool RegionGetEnabled(Rid region)
Parameters
region
Rid
Returns
RegionGetEnterCost(Rid)
Returns the enter cost of this region
.
public float RegionGetEnterCost(Rid region)
Parameters
region
Rid
Returns
RegionGetMap(Rid)
Returns the navigation map Rid the requested region
is currently assigned to.
public Rid RegionGetMap(Rid region)
Parameters
region
Rid
Returns
RegionGetNavigationLayers(Rid)
Returns the region's navigation layers.
public uint RegionGetNavigationLayers(Rid region)
Parameters
region
Rid
Returns
RegionGetOwnerId(Rid)
Returns the ObjectID
of the object which manages this region.
public ulong RegionGetOwnerId(Rid region)
Parameters
region
Rid
Returns
RegionGetTravelCost(Rid)
Returns the travel cost of this region
.
public float RegionGetTravelCost(Rid region)
Parameters
region
Rid
Returns
RegionGetUseEdgeConnections(Rid)
Returns whether the navigation region
is set to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
public bool RegionGetUseEdgeConnections(Rid region)
Parameters
region
Rid
Returns
RegionOwnsPoint(Rid, Vector2)
Returns true
if the provided point
in world space is currently owned by the provided navigation region
. Owned in this context means that one of the region's navigation mesh polygon faces has a possible position at the closest distance to this point compared to all other navigation meshes from other navigation regions that are also registered on the navigation map of the provided region.
If multiple navigation meshes have positions at equal distance the navigation region whose polygons are processed first wins the ownership. Polygons are processed in the same order that navigation regions were registered on the NavigationServer.
Note: If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
public bool RegionOwnsPoint(Rid region, Vector2 point)
Parameters
Returns
RegionSetEnabled(Rid, bool)
If enabled
is true
the specified region
will contribute to its current navigation map.
public void RegionSetEnabled(Rid region, bool enabled)
Parameters
RegionSetEnterCost(Rid, float)
Sets the enterCost
for this region
.
public void RegionSetEnterCost(Rid region, float enterCost)
Parameters
RegionSetMap(Rid, Rid)
Sets the map for the region.
public void RegionSetMap(Rid region, Rid map)
Parameters
RegionSetNavigationLayers(Rid, uint)
Set the region's navigation layers. This allows selecting regions from a path request (when using MapGetPath(Rid, Vector2, Vector2, bool, uint)).
public void RegionSetNavigationLayers(Rid region, uint navigationLayers)
Parameters
RegionSetNavigationPolygon(Rid, NavigationPolygon)
Sets the navigationPolygon
for the region.
public void RegionSetNavigationPolygon(Rid region, NavigationPolygon navigationPolygon)
Parameters
region
RidnavigationPolygon
NavigationPolygon
RegionSetOwnerId(Rid, ulong)
Set the ObjectID
of the object which manages this region.
public void RegionSetOwnerId(Rid region, ulong ownerId)
Parameters
RegionSetTransform(Rid, Transform2D)
Sets the global transformation for the region.
public void RegionSetTransform(Rid region, Transform2D transform)
Parameters
region
Ridtransform
Transform2D
RegionSetTravelCost(Rid, float)
Sets the travelCost
for this region
.
public void RegionSetTravelCost(Rid region, float travelCost)
Parameters
RegionSetUseEdgeConnections(Rid, bool)
If enabled
is true
, the navigation region
will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
public void RegionSetUseEdgeConnections(Rid region, bool enabled)
Parameters
SetDebugEnabled(bool)
If true
enables debug mode on the NavigationServer.
public void SetDebugEnabled(bool enabled)
Parameters
enabled
bool
Events
MapChanged
Emitted when a navigation map is updated, when a region moves or is modified.
public event NavigationServer2DInstance.MapChangedEventHandler MapChanged
Event Type
NavigationDebugChanged
Emitted when navigation debug settings are changed. Only available in debug builds.
public event Action NavigationDebugChanged