Ported from godot4: Rename Navigation uses of 'location' to 'position'

Contrary to the entire rest of the engine NavigationAgent's and NavigationLinks decided to deal with locations instead of positions.
- smix8
bf1571979c
This commit is contained in:
Relintai 2023-06-09 10:28:31 +02:00
parent b940854ca9
commit c11500d480
23 changed files with 188 additions and 188 deletions

View File

@ -142,14 +142,14 @@
<method name="link_create" qualifiers="const">
<return type="RID" />
<description>
Create a new link between two locations on a map.
Create a new link between two positions on a map.
</description>
</method>
<method name="link_get_end_location" qualifiers="const">
<method name="link_get_end_position" qualifiers="const">
<return type="Vector2" />
<param index="0" name="link" type="RID" />
<description>
Returns the ending location of this [code]link[/code].
Returns the ending position of this [code]link[/code].
</description>
</method>
<method name="link_get_enter_cost" qualifiers="const">
@ -173,11 +173,11 @@
Returns the navigation layers for this [code]link[/code].
</description>
</method>
<method name="link_get_start_location" qualifiers="const">
<method name="link_get_start_position" qualifiers="const">
<return type="Vector2" />
<param index="0" name="link" type="RID" />
<description>
Returns the starting location of this [code]link[/code].
Returns the starting position of this [code]link[/code].
</description>
</method>
<method name="link_get_travel_cost" qualifiers="const">
@ -202,12 +202,12 @@
Sets whether this [code]link[/code] can be travelled in both directions.
</description>
</method>
<method name="link_set_end_location" qualifiers="const">
<method name="link_set_end_position" qualifiers="const">
<return type="void" />
<param index="0" name="link" type="RID" />
<param index="1" name="location" type="Vector2" />
<param index="1" name="position" type="Vector2" />
<description>
Sets the exit location for the [code]link[/code].
Sets the exit position for the [code]link[/code].
</description>
</method>
<method name="link_set_enter_cost" qualifiers="const">
@ -234,12 +234,12 @@
Set the links's navigation layers. This allows selecting links from a path request (when using [method NavigationServer2D.map_get_path]).
</description>
</method>
<method name="link_set_start_location" qualifiers="const">
<method name="link_set_start_position" qualifiers="const">
<return type="void" />
<param index="0" name="link" type="RID" />
<param index="1" name="location" type="Vector2" />
<param index="1" name="position" type="Vector2" />
<description>
Sets the entry location for this [code]link[/code].
Sets the entry position for this [code]link[/code].
</description>
</method>
<method name="link_set_travel_cost" qualifiers="const">

View File

@ -4,8 +4,8 @@
3D agent used in navigation for collision avoidance.
</brief_description>
<description>
3D agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent] is physics safe.
[b]Note:[/b] After setting [member target_location] it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
3D agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent] is physics safe.
[b]Note:[/b] After setting [member target_position] it is required to use the [method get_next_position] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
[b]Note:[/b] By default, the expensive calculations for avoidance are done in a thread. In HTML5 exports without thread support, they will be done on the main thread, which can lead to performance issues.
</description>
<tutorials>
@ -14,19 +14,19 @@
<method name="distance_to_target" qualifiers="const">
<return type="float" />
<description>
Returns the distance to the target location, using the agent's global position. The user must set [member target_location] in order for this to be accurate.
Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate.
</description>
</method>
<method name="get_final_location">
<method name="get_final_position">
<return type="Vector3" />
<description>
Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
</description>
</method>
<method name="get_nav_path" qualifiers="const">
<return type="PoolVector3Array" />
<description>
Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
</description>
</method>
<method name="get_nav_path_index" qualifiers="const">
@ -47,10 +47,10 @@
Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer.
</description>
</method>
<method name="get_next_location">
<method name="get_next_position">
<return type="Vector3" />
<description>
Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
</description>
</method>
<method name="get_rid" qualifiers="const">
@ -62,19 +62,19 @@
<method name="is_navigation_finished">
<return type="bool" />
<description>
Returns [code]true[/code] if the navigation path's final location has been reached.
Returns [code]true[/code] if the navigation path's final position has been reached.
</description>
</method>
<method name="is_target_reachable">
<return type="bool" />
<description>
Returns [code]true[/code] if [member target_location] is reachable.
Returns [code]true[/code] if [member target_position] is reachable.
</description>
</method>
<method name="is_target_reached" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if [member target_location] is reached. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location].
Returns [code]true[/code] if [member target_position] is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See [method get_final_position].
</description>
</method>
<method name="set_navigation">
@ -125,7 +125,7 @@
The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update.
</member>
<member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="3.0">
The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
</member>
<member name="radius" type="float" setter="set_radius" getter="get_radius" default="1.0">
The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_dist]).
@ -134,8 +134,8 @@
<member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0">
The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update.
</member>
<member name="target_location" type="Vector3" setter="set_target_location" getter="get_target_location" default="Vector3( 0, 0, 0 )">
The user-defined target location. Setting this property will clear the current navigation path.
<member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3( 0, 0, 0 )">
The user-defined target position. Setting this property will clear the current navigation path.
</member>
<member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="0.0">
The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but the less freedom in choosing its velocities. Must be positive.
@ -144,7 +144,7 @@
<signals>
<signal name="navigation_finished">
<description>
Notifies when the final location is reached.
Notifies when the final position is reached.
</description>
</signal>
<signal name="path_changed">
@ -154,7 +154,7 @@
</signal>
<signal name="target_reached">
<description>
Notifies when the player-defined [member target_location] is reached.
Notifies when the player-defined [member target_position] is reached.
</description>
</signal>
<signal name="velocity_computed">

View File

@ -4,8 +4,8 @@
2D agent used in navigation for collision avoidance.
</brief_description>
<description>
2D agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World2D] navigation map. If this node is a child of a [Navigation2D] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent2D] is physics safe.
[b]Note:[/b] After setting [member target_location] it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
2D agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World2D] navigation map. If this node is a child of a [Navigation2D] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent2D] is physics safe.
[b]Note:[/b] After setting [member target_position] it is required to use the [method get_next_position] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
[b]Note:[/b] By default, the expensive calculations for avoidance are done in a thread. In HTML5 exports without thread support, they will be done on the main thread, which can lead to performance issues.
</description>
<tutorials>
@ -14,19 +14,19 @@
<method name="distance_to_target" qualifiers="const">
<return type="float" />
<description>
Returns the distance to the target location, using the agent's global position. The user must set [member target_location] in order for this to be accurate.
Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate.
</description>
</method>
<method name="get_final_location">
<method name="get_final_position">
<return type="Vector2" />
<description>
Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
</description>
</method>
<method name="get_nav_path" qualifiers="const">
<return type="PoolVector2Array" />
<description>
Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
</description>
</method>
<method name="get_nav_path_index" qualifiers="const">
@ -47,10 +47,10 @@
Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer.
</description>
</method>
<method name="get_next_location">
<method name="get_next_position">
<return type="Vector2" />
<description>
Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
</description>
</method>
<method name="get_rid" qualifiers="const">
@ -62,19 +62,19 @@
<method name="is_navigation_finished">
<return type="bool" />
<description>
Returns [code]true[/code] if the navigation path's final location has been reached.
Returns [code]true[/code] if the navigation path's final position has been reached.
</description>
</method>
<method name="is_target_reachable">
<return type="bool" />
<description>
Returns [code]true[/code] if [member target_location] is reachable.
Returns [code]true[/code] if [member target_position] is reachable.
</description>
</method>
<method name="is_target_reached" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if [member target_location] is reached. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location].
Returns [code]true[/code] if [member target_position] is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See [method get_final_position].
</description>
</method>
<method name="set_navigation">
@ -119,7 +119,7 @@
The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update.
</member>
<member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="3.0">
The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
</member>
<member name="radius" type="float" setter="set_radius" getter="get_radius" default="0.0">
The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_dist]).
@ -128,8 +128,8 @@
<member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0">
The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update.
</member>
<member name="target_location" type="Vector2" setter="set_target_location" getter="get_target_location" default="Vector2( 0, 0 )">
The user-defined target location. Setting this property will clear the current navigation path.
<member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2( 0, 0 )">
The user-defined target position. Setting this property will clear the current navigation path.
</member>
<member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="0.0">
The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but the less freedom in choosing its velocities. Must be positive.
@ -138,7 +138,7 @@
<signals>
<signal name="navigation_finished">
<description>
Notifies when the final location is reached.
Notifies when the final position is reached.
</description>
</signal>
<signal name="path_changed">
@ -148,7 +148,7 @@
</signal>
<signal name="target_reached">
<description>
Notifies when the player-defined [member target_location] is reached.
Notifies when the player-defined [member target_position] is reached.
</description>
</signal>
<signal name="velocity_computed">

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NavigationLink3D" inherits="Node3D" is_experimental="true" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<class name="NavigationLink3D" inherits="Spatial" is_experimental="true" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A link between two positions on [NavigationRegion3D]s that agents can be routed through.
</brief_description>

View File

@ -150,14 +150,14 @@
<method name="link_create" qualifiers="const">
<return type="RID" />
<description>
Create a new link between two locations on a map.
Create a new link between two positions on a map.
</description>
</method>
<method name="link_get_end_location" qualifiers="const">
<method name="link_get_end_position" qualifiers="const">
<return type="Vector3" />
<param index="0" name="link" type="RID" />
<description>
Returns the ending location of this [code]link[/code].
Returns the ending position of this [code]link[/code].
</description>
</method>
<method name="link_get_enter_cost" qualifiers="const">
@ -181,11 +181,11 @@
Returns the navigation layers for this [code]link[/code].
</description>
</method>
<method name="link_get_start_location" qualifiers="const">
<method name="link_get_start_position" qualifiers="const">
<return type="Vector3" />
<param index="0" name="link" type="RID" />
<description>
Returns the starting location of this [code]link[/code].
Returns the starting position of this [code]link[/code].
</description>
</method>
<method name="link_get_travel_cost" qualifiers="const">
@ -210,12 +210,12 @@
Sets whether this [code]link[/code] can be travelled in both directions.
</description>
</method>
<method name="link_set_end_location" qualifiers="const">
<method name="link_set_end_position" qualifiers="const">
<return type="void" />
<param index="0" name="link" type="RID" />
<param index="1" name="location" type="Vector3" />
<param index="1" name="position" type="Vector3" />
<description>
Sets the exit location for the [code]link[/code].
Sets the exit position for the [code]link[/code].
</description>
</method>
<method name="link_set_enter_cost" qualifiers="const">
@ -242,12 +242,12 @@
Set the links's navigation layers. This allows selecting links from a path request (when using [method NavigationServer3D.map_get_path]).
</description>
</method>
<method name="link_set_start_location" qualifiers="const">
<method name="link_set_start_position" qualifiers="const">
<return type="void" />
<param index="0" name="link" type="RID" />
<param index="1" name="location" type="Vector3" />
<param index="1" name="position" type="Vector3" />
<description>
Sets the entry location for this [code]link[/code].
Sets the entry position for this [code]link[/code].
</description>
</method>
<method name="link_set_travel_cost" qualifiers="const">

View File

@ -3745,8 +3745,8 @@ void NavigationLink3DGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Vector3 up_vector = NavigationServer::get_singleton()->map_get_up(nav_map);
Vector3::Axis up_axis = static_cast<Vector3::Axis>(up_vector.max_axis());
Vector3 start_location = link->get_start_position();
Vector3 end_location = link->get_end_position();
Vector3 start_position = link->get_start_position();
Vector3 end_position = link->get_end_position();
Ref<Material> link_material = get_material("navigation_link_material", p_gizmo);
Ref<Material> link_material_disabled = get_material("navigation_link_material_disabled", p_gizmo);
@ -3756,10 +3756,10 @@ void NavigationLink3DGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
// Draw line between the points.
Vector<Vector3> lines;
lines.push_back(start_location);
lines.push_back(end_location);
lines.push_back(start_position);
lines.push_back(end_position);
// Draw start location search radius
// Draw start position search radius
for (int i = 0; i < 30; i++) {
// Create a circle
const float ra = Math::deg2rad((float)(i * 12));
@ -3770,21 +3770,21 @@ void NavigationLink3DGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
// Draw axis-aligned circle
switch (up_axis) {
case Vector3::AXIS_X:
lines.push_back(start_location + Vector3(0, a.x, a.y));
lines.push_back(start_location + Vector3(0, b.x, b.y));
lines.push_back(start_position + Vector3(0, a.x, a.y));
lines.push_back(start_position + Vector3(0, b.x, b.y));
break;
case Vector3::AXIS_Y:
lines.push_back(start_location + Vector3(a.x, 0, a.y));
lines.push_back(start_location + Vector3(b.x, 0, b.y));
lines.push_back(start_position + Vector3(a.x, 0, a.y));
lines.push_back(start_position + Vector3(b.x, 0, b.y));
break;
case Vector3::AXIS_Z:
lines.push_back(start_location + Vector3(a.x, a.y, 0));
lines.push_back(start_location + Vector3(b.x, b.y, 0));
lines.push_back(start_position + Vector3(a.x, a.y, 0));
lines.push_back(start_position + Vector3(b.x, b.y, 0));
break;
}
}
// Draw end location search radius
// Draw end position search radius
for (int i = 0; i < 30; i++) {
// Create a circle
const float ra = Math::deg2rad((float)(i * 12));
@ -3795,16 +3795,16 @@ void NavigationLink3DGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
// Draw axis-aligned circle
switch (up_axis) {
case Vector3::AXIS_X:
lines.push_back(end_location + Vector3(0, a.x, a.y));
lines.push_back(end_location + Vector3(0, b.x, b.y));
lines.push_back(end_position + Vector3(0, a.x, a.y));
lines.push_back(end_position + Vector3(0, b.x, b.y));
break;
case Vector3::AXIS_Y:
lines.push_back(end_location + Vector3(a.x, 0, a.y));
lines.push_back(end_location + Vector3(b.x, 0, b.y));
lines.push_back(end_position + Vector3(a.x, 0, a.y));
lines.push_back(end_position + Vector3(b.x, 0, b.y));
break;
case Vector3::AXIS_Z:
lines.push_back(end_location + Vector3(a.x, a.y, 0));
lines.push_back(end_location + Vector3(b.x, b.y, 0));
lines.push_back(end_position + Vector3(a.x, a.y, 0));
lines.push_back(end_position + Vector3(b.x, b.y, 0));
break;
}
}
@ -3813,8 +3813,8 @@ void NavigationLink3DGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_collision_segments(lines);
Vector<Vector3> handles;
handles.push_back(start_location);
handles.push_back(end_location);
handles.push_back(start_position);
handles.push_back(end_position);
p_gizmo->add_handles(handles, handles_material);
}
@ -3839,8 +3839,8 @@ void NavigationLink3DGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
Vector3 location = p_id == 0 ? link->get_start_position() : link->get_end_position();
Plane move_plane = Plane(cam_dir, gt.xform(location));
Vector3 position = p_id == 0 ? link->get_start_position() : link->get_end_position();
Plane move_plane = Plane(cam_dir, gt.xform(position));
Vector3 intersection;
if (!move_plane.intersects_ray(ray_from, ray_dir, &intersection)) {
@ -3852,11 +3852,11 @@ void NavigationLink3DGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_
intersection.snap(Vector3(snap, snap, snap));
}
location = gi.xform(intersection);
position = gi.xform(intersection);
if (p_id == 0) {
link->set_start_position(location);
link->set_start_position(position);
} else if (p_id == 1) {
link->set_end_position(location);
link->set_end_position(position);
}
}

View File

@ -130,7 +130,7 @@ struct NavigationPoly {
Vector3 back_navigation_edge_pathway_start;
Vector3 back_navigation_edge_pathway_end;
/// The entry location of this poly.
/// The entry position of this poly.
Vector3 entry;
/// The distance to the destination.
real_t traveled_distance;

View File

@ -266,10 +266,10 @@ void FORWARD_2_C(link_set_bidirectional, RID, p_link, bool, p_bidirectional, rid
bool FORWARD_1_C(link_is_bidirectional, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers, rid_to_rid, uint32_to_uint32);
uint32_t FORWARD_1_C(link_get_navigation_layers, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_start_location, RID, p_link, Vector2, p_location, rid_to_rid, v2_to_v3);
Vector2 FORWARD_1_R_C(v3_to_v2, link_get_start_location, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_end_location, RID, p_link, Vector2, p_location, rid_to_rid, v2_to_v3);
Vector2 FORWARD_1_R_C(v3_to_v2, link_get_end_location, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_start_position, RID, p_link, Vector2, p_position, rid_to_rid, v2_to_v3);
Vector2 FORWARD_1_R_C(v3_to_v2, link_get_start_position, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_end_position, RID, p_link, Vector2, p_position, rid_to_rid, v2_to_v3);
Vector2 FORWARD_1_R_C(v3_to_v2, link_get_end_position, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_enter_cost, RID, p_link, real_t, p_enter_cost, rid_to_rid, real_to_real);
real_t FORWARD_1_C(link_get_enter_cost, RID, p_link, rid_to_rid);
void FORWARD_2_C(link_set_travel_cost, RID, p_link, real_t, p_travel_cost, rid_to_rid, real_to_real);

View File

@ -123,7 +123,7 @@ public:
virtual Vector2 region_get_connection_pathway_start(RID p_region, int p_connection_id) const;
virtual Vector2 region_get_connection_pathway_end(RID p_region, int p_connection_id) const;
/// Creates a new link between locations in the nav map.
/// Creates a new link between positions in the nav map.
virtual RID link_create() const;
/// Set the map of this link.
@ -138,13 +138,13 @@ public:
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) const;
virtual uint32_t link_get_navigation_layers(RID p_link) const;
/// Set the start location of the link.
virtual void link_set_start_location(RID p_link, Vector2 p_location) const;
virtual Vector2 link_get_start_location(RID p_link) const;
/// Set the start position of the link.
virtual void link_set_start_position(RID p_link, Vector2 p_position) const;
virtual Vector2 link_get_start_position(RID p_link) const;
/// Set the end location of the link.
virtual void link_set_end_location(RID p_link, Vector2 p_location) const;
virtual Vector2 link_get_end_location(RID p_link) const;
/// Set the end position of the link.
virtual void link_set_end_position(RID p_link, Vector2 p_position) const;
virtual Vector2 link_get_end_position(RID p_link) const;
/// Set the enter cost of the link.
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) const;

View File

@ -531,28 +531,28 @@ uint32_t PandemoniumNavigationServer::link_get_navigation_layers(const RID p_lin
return link->get_navigation_layers();
}
COMMAND_2(link_set_start_location, RID, p_link, Vector3, p_location) {
COMMAND_2(link_set_start_position, RID, p_link, Vector3, p_position) {
NavLink *link = link_owner.getornull(p_link);
ERR_FAIL_COND(link == nullptr);
link->set_start_position(p_location);
link->set_start_position(p_position);
}
Vector3 PandemoniumNavigationServer::link_get_start_location(RID p_link) const {
Vector3 PandemoniumNavigationServer::link_get_start_position(RID p_link) const {
const NavLink *link = link_owner.getornull(p_link);
ERR_FAIL_COND_V(link == nullptr, Vector3());
return link->get_start_position();
}
COMMAND_2(link_set_end_location, RID, p_link, Vector3, p_location) {
COMMAND_2(link_set_end_position, RID, p_link, Vector3, p_position) {
NavLink *link = link_owner.getornull(p_link);
ERR_FAIL_COND(link == nullptr);
link->set_end_position(p_location);
link->set_end_position(p_position);
}
Vector3 PandemoniumNavigationServer::link_get_end_location(RID p_link) const {
Vector3 PandemoniumNavigationServer::link_get_end_position(RID p_link) const {
const NavLink *link = link_owner.getornull(p_link);
ERR_FAIL_COND_V(link == nullptr, Vector3());

View File

@ -156,10 +156,10 @@ public:
virtual bool link_is_bidirectional(RID p_link) const;
COMMAND_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers);
virtual uint32_t link_get_navigation_layers(RID p_link) const;
COMMAND_2(link_set_start_location, RID, p_link, Vector3, p_location);
virtual Vector3 link_get_start_location(RID p_link) const;
COMMAND_2(link_set_end_location, RID, p_link, Vector3, p_location);
virtual Vector3 link_get_end_location(RID p_link) const;
COMMAND_2(link_set_start_position, RID, p_link, Vector3, p_position);
virtual Vector3 link_get_start_position(RID p_link) const;
COMMAND_2(link_set_end_position, RID, p_link, Vector3, p_position);
virtual Vector3 link_get_end_position(RID p_link) const;
COMMAND_2(link_set_enter_cost, RID, p_link, real_t, p_enter_cost);
virtual real_t link_get_enter_cost(RID p_link) const;
COMMAND_2(link_set_travel_cost, RID, p_link, real_t, p_travel_cost);

View File

@ -56,10 +56,10 @@ public:
virtual bool link_is_bidirectional(RID p_link) const { return false; }
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) const {}
virtual uint32_t link_get_navigation_layers(RID p_link) const { return 0; }
virtual void link_set_start_location(RID p_link, Vector2 p_location) const {}
virtual Vector2 link_get_start_location(RID p_link) const { return Vector2(); }
virtual void link_set_end_location(RID p_link, Vector2 p_location) const {}
virtual Vector2 link_get_end_location(RID p_link) const { return Vector2(); }
virtual void link_set_start_position(RID p_link, Vector2 p_position) const {}
virtual Vector2 link_get_start_position(RID p_link) const { return Vector2(); }
virtual void link_set_end_position(RID p_link, Vector2 p_position) const {}
virtual Vector2 link_get_end_position(RID p_link) const { return Vector2(); }
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) const {}
virtual real_t link_get_enter_cost(RID p_link) const { return 0; }
virtual void link_set_travel_cost(RID p_link, real_t p_travel_cost) const {}

View File

@ -58,10 +58,10 @@ public:
virtual bool link_is_bidirectional(RID p_link) const { return false; }
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) const {}
virtual uint32_t link_get_navigation_layers(RID p_link) const { return 0; }
virtual void link_set_start_location(RID p_link, Vector3 p_location) const {}
virtual Vector3 link_get_start_location(RID p_link) const { return Vector3(); }
virtual void link_set_end_location(RID p_link, Vector3 p_location) const {}
virtual Vector3 link_get_end_location(RID p_link) const { return Vector3(); }
virtual void link_set_start_position(RID p_link, Vector3 p_position) const {}
virtual Vector3 link_get_start_position(RID p_link) const { return Vector3(); }
virtual void link_set_end_position(RID p_link, Vector3 p_position) const {}
virtual Vector3 link_get_end_position(RID p_link) const { return Vector3(); }
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) const {}
virtual real_t link_get_enter_cost(RID p_link) const { return 0; }
virtual void link_set_travel_cost(RID p_link, real_t p_travel_cost) const {}

View File

@ -75,10 +75,10 @@ void NavigationAgent2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationAgent2D::set_navigation_map);
ClassDB::bind_method(D_METHOD("get_navigation_map"), &NavigationAgent2D::get_navigation_map);
ClassDB::bind_method(D_METHOD("set_target_location", "location"), &NavigationAgent2D::set_target_location);
ClassDB::bind_method(D_METHOD("get_target_location"), &NavigationAgent2D::get_target_location);
ClassDB::bind_method(D_METHOD("set_target_position", "position"), &NavigationAgent2D::set_target_position);
ClassDB::bind_method(D_METHOD("get_target_position"), &NavigationAgent2D::get_target_position);
ClassDB::bind_method(D_METHOD("get_next_location"), &NavigationAgent2D::get_next_location);
ClassDB::bind_method(D_METHOD("get_next_position"), &NavigationAgent2D::get_next_position);
ClassDB::bind_method(D_METHOD("distance_to_target"), &NavigationAgent2D::distance_to_target);
ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &NavigationAgent2D::set_velocity);
ClassDB::bind_method(D_METHOD("get_nav_path"), &NavigationAgent2D::get_nav_path);
@ -86,12 +86,12 @@ void NavigationAgent2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_target_reached"), &NavigationAgent2D::is_target_reached);
ClassDB::bind_method(D_METHOD("is_target_reachable"), &NavigationAgent2D::is_target_reachable);
ClassDB::bind_method(D_METHOD("is_navigation_finished"), &NavigationAgent2D::is_navigation_finished);
ClassDB::bind_method(D_METHOD("get_final_location"), &NavigationAgent2D::get_final_location);
ClassDB::bind_method(D_METHOD("get_final_position"), &NavigationAgent2D::get_final_position);
ClassDB::bind_method(D_METHOD("_avoidance_done", "new_velocity"), &NavigationAgent2D::_avoidance_done);
ADD_GROUP("Pathfinding", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "target_location", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_target_location", "get_target_location");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "target_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_target_position", "get_target_position");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_path_desired_distance", "get_path_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "target_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_target_desired_distance", "get_target_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_max_distance", PROPERTY_HINT_RANGE, "10,100,1"), "set_path_max_distance", "get_path_max_distance");
@ -342,16 +342,16 @@ real_t NavigationAgent2D::get_path_max_distance() {
return path_max_distance;
}
void NavigationAgent2D::set_target_location(Vector2 p_location) {
target_location = p_location;
void NavigationAgent2D::set_target_position(Vector2 p_position) {
target_position = p_position;
_request_repath();
}
Vector2 NavigationAgent2D::get_target_location() const {
return target_location;
Vector2 NavigationAgent2D::get_target_position() const {
return target_position;
}
Vector2 NavigationAgent2D::get_next_location() {
Vector2 NavigationAgent2D::get_next_position() {
update_navigation();
if (navigation_path.size() == 0) {
ERR_FAIL_COND_V(agent_parent == nullptr, Vector2());
@ -363,7 +363,7 @@ Vector2 NavigationAgent2D::get_next_location() {
real_t NavigationAgent2D::distance_to_target() const {
ERR_FAIL_COND_V(agent_parent == nullptr, 0.0);
return agent_parent->get_global_transform().get_origin().distance_to(target_location);
return agent_parent->get_global_transform().get_origin().distance_to(target_position);
}
bool NavigationAgent2D::is_target_reached() const {
@ -371,7 +371,7 @@ bool NavigationAgent2D::is_target_reached() const {
}
bool NavigationAgent2D::is_target_reachable() {
return target_desired_distance >= get_final_location().distance_to(target_location);
return target_desired_distance >= get_final_position().distance_to(target_position);
}
bool NavigationAgent2D::is_navigation_finished() {
@ -379,7 +379,7 @@ bool NavigationAgent2D::is_navigation_finished() {
return navigation_finished;
}
Vector2 NavigationAgent2D::get_final_location() {
Vector2 NavigationAgent2D::get_final_position() {
update_navigation();
if (navigation_path.size() == 0) {
return Vector2();
@ -452,11 +452,11 @@ void NavigationAgent2D::update_navigation() {
if (reload_path) {
if (map_override.is_valid()) {
navigation_path = Navigation2DServer::get_singleton()->map_get_path(map_override, o, target_location, true, navigation_layers);
navigation_path = Navigation2DServer::get_singleton()->map_get_path(map_override, o, target_position, true, navigation_layers);
} else if (navigation != nullptr) {
navigation_path = Navigation2DServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_location, true, navigation_layers);
navigation_path = Navigation2DServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_position, true, navigation_layers);
} else {
navigation_path = Navigation2DServer::get_singleton()->map_get_path(agent_parent->get_world_2d()->get_navigation_map(), o, target_location, true, navigation_layers);
navigation_path = Navigation2DServer::get_singleton()->map_get_path(agent_parent->get_world_2d()->get_navigation_map(), o, target_position, true, navigation_layers);
}
navigation_finished = false;
@ -470,7 +470,7 @@ void NavigationAgent2D::update_navigation() {
// Check if we can advance the navigation path
if (navigation_finished == false) {
// Advances to the next far away location.
// Advances to the next far away position.
while (o.distance_to(navigation_path[nav_path_index]) < path_desired_distance) {
nav_path_index += 1;
if (nav_path_index == navigation_path.size()) {

View File

@ -58,7 +58,7 @@ class NavigationAgent2D : public Node {
real_t path_max_distance;
Vector2 target_location;
Vector2 target_position;
Vector<Vector2> navigation_path;
int nav_path_index;
bool velocity_submitted;
@ -139,10 +139,10 @@ public:
void set_path_max_distance(real_t p_pmd);
real_t get_path_max_distance();
void set_target_location(Vector2 p_location);
Vector2 get_target_location() const;
void set_target_position(Vector2 p_position);
Vector2 get_target_position() const;
Vector2 get_next_location();
Vector2 get_next_position();
Vector<Vector2> get_nav_path() const {
return navigation_path;
@ -156,7 +156,7 @@ public:
bool is_target_reached() const;
bool is_target_reachable();
bool is_navigation_finished();
Vector2 get_final_location();
Vector2 get_final_position();
void set_velocity(Vector2 p_velocity);
void _avoidance_done(Vector3 p_new_velocity);

View File

@ -83,8 +83,8 @@ void NavigationLink2D::_notification(int p_what) {
Navigation2DServer::get_singleton()->link_set_map(link, get_world_2d()->get_navigation_map());
}
current_global_transform = get_global_transform();
Navigation2DServer::get_singleton()->link_set_start_location(link, current_global_transform.xform(start_position));
Navigation2DServer::get_singleton()->link_set_end_location(link, current_global_transform.xform(end_position));
Navigation2DServer::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
Navigation2DServer::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
@ -97,8 +97,8 @@ void NavigationLink2D::_notification(int p_what) {
Transform2D new_global_transform = get_global_transform();
if (current_global_transform != new_global_transform) {
current_global_transform = new_global_transform;
Navigation2DServer::get_singleton()->link_set_start_location(link, current_global_transform.xform(start_position));
Navigation2DServer::get_singleton()->link_set_end_location(link, current_global_transform.xform(end_position));
Navigation2DServer::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
Navigation2DServer::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
update();
}
}
@ -227,7 +227,7 @@ void NavigationLink2D::set_start_position(Vector2 p_position) {
return;
}
Navigation2DServer::get_singleton()->link_set_start_location(link, current_global_transform.xform(start_position));
Navigation2DServer::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
update_configuration_warning();
@ -249,7 +249,7 @@ void NavigationLink2D::set_end_position(Vector2 p_position) {
return;
}
Navigation2DServer::get_singleton()->link_set_end_location(link, current_global_transform.xform(end_position));
Navigation2DServer::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
update_configuration_warning();

View File

@ -81,10 +81,10 @@ void NavigationAgent::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &NavigationAgent::set_navigation_layers);
ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationAgent::get_navigation_layers);
ClassDB::bind_method(D_METHOD("set_target_location", "location"), &NavigationAgent::set_target_location);
ClassDB::bind_method(D_METHOD("get_target_location"), &NavigationAgent::get_target_location);
ClassDB::bind_method(D_METHOD("set_target_position", "position"), &NavigationAgent::set_target_position);
ClassDB::bind_method(D_METHOD("get_target_position"), &NavigationAgent::get_target_position);
ClassDB::bind_method(D_METHOD("get_next_location"), &NavigationAgent::get_next_location);
ClassDB::bind_method(D_METHOD("get_next_position"), &NavigationAgent::get_next_position);
ClassDB::bind_method(D_METHOD("distance_to_target"), &NavigationAgent::distance_to_target);
ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &NavigationAgent::set_velocity);
ClassDB::bind_method(D_METHOD("get_nav_path"), &NavigationAgent::get_nav_path);
@ -92,12 +92,12 @@ void NavigationAgent::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_target_reached"), &NavigationAgent::is_target_reached);
ClassDB::bind_method(D_METHOD("is_target_reachable"), &NavigationAgent::is_target_reachable);
ClassDB::bind_method(D_METHOD("is_navigation_finished"), &NavigationAgent::is_navigation_finished);
ClassDB::bind_method(D_METHOD("get_final_location"), &NavigationAgent::get_final_location);
ClassDB::bind_method(D_METHOD("get_final_position"), &NavigationAgent::get_final_position);
ClassDB::bind_method(D_METHOD("_avoidance_done", "new_velocity"), &NavigationAgent::_avoidance_done);
ADD_GROUP("Pathfinding", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "target_location", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_target_location", "get_target_location");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "target_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_target_position", "get_target_position");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_path_desired_distance", "get_path_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "target_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_target_desired_distance", "get_target_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_height_offset", PROPERTY_HINT_RANGE, "-100.0,100,0.01"), "set_agent_height_offset", "get_agent_height_offset");
@ -358,16 +358,16 @@ real_t NavigationAgent::get_path_max_distance() {
return path_max_distance;
}
void NavigationAgent::set_target_location(Vector3 p_location) {
target_location = p_location;
void NavigationAgent::set_target_position(Vector3 p_position) {
target_position = p_position;
_request_repath();
}
Vector3 NavigationAgent::get_target_location() const {
return target_location;
Vector3 NavigationAgent::get_target_position() const {
return target_position;
}
Vector3 NavigationAgent::get_next_location() {
Vector3 NavigationAgent::get_next_position() {
update_navigation();
if (navigation_path.size() == 0) {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector3(), "The agent has no parent.");
@ -379,7 +379,7 @@ Vector3 NavigationAgent::get_next_location() {
real_t NavigationAgent::distance_to_target() const {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, 0.0, "The agent has no parent.");
return agent_parent->get_global_transform().origin.distance_to(target_location);
return agent_parent->get_global_transform().origin.distance_to(target_position);
}
bool NavigationAgent::is_target_reached() const {
@ -387,7 +387,7 @@ bool NavigationAgent::is_target_reached() const {
}
bool NavigationAgent::is_target_reachable() {
return target_desired_distance >= get_final_location().distance_to(target_location);
return target_desired_distance >= get_final_position().distance_to(target_position);
}
bool NavigationAgent::is_navigation_finished() {
@ -395,7 +395,7 @@ bool NavigationAgent::is_navigation_finished() {
return navigation_finished;
}
Vector3 NavigationAgent::get_final_location() {
Vector3 NavigationAgent::get_final_position() {
update_navigation();
if (navigation_path.size() == 0) {
return Vector3();
@ -473,11 +473,11 @@ void NavigationAgent::update_navigation() {
if (reload_path) {
if (map_override.is_valid()) {
navigation_path = NavigationServer::get_singleton()->map_get_path(map_override, o, target_location, true, navigation_layers);
navigation_path = NavigationServer::get_singleton()->map_get_path(map_override, o, target_position, true, navigation_layers);
} else if (navigation != nullptr) {
navigation_path = NavigationServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_location, true, navigation_layers);
navigation_path = NavigationServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_position, true, navigation_layers);
} else {
navigation_path = NavigationServer::get_singleton()->map_get_path(agent_parent->get_world_3d()->get_navigation_map(), o, target_location, true, navigation_layers);
navigation_path = NavigationServer::get_singleton()->map_get_path(agent_parent->get_world_3d()->get_navigation_map(), o, target_position, true, navigation_layers);
}
navigation_finished = false;
@ -491,7 +491,7 @@ void NavigationAgent::update_navigation() {
// Check if we can advance the navigation path
if (navigation_finished == false) {
// Advances to the next far away location.
// Advances to the next far away position.
while (o.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) {
nav_path_index += 1;
if (nav_path_index == navigation_path.size()) {

View File

@ -61,7 +61,7 @@ class NavigationAgent : public Node {
real_t path_max_distance;
Vector3 target_location;
Vector3 target_position;
Vector<Vector3> navigation_path;
int nav_path_index;
bool velocity_submitted;
@ -152,10 +152,10 @@ public:
void set_path_max_distance(real_t p_pmd);
real_t get_path_max_distance();
void set_target_location(Vector3 p_location);
Vector3 get_target_location() const;
void set_target_position(Vector3 p_position);
Vector3 get_target_position() const;
Vector3 get_next_location();
Vector3 get_next_position();
Vector<Vector3> get_nav_path() const {
return navigation_path;
@ -169,7 +169,7 @@ public:
bool is_target_reached() const;
bool is_target_reachable();
bool is_navigation_finished();
Vector3 get_final_location();
Vector3 get_final_position();
void set_velocity(Vector3 p_velocity);
void _avoidance_done(Vector3 p_new_velocity);

View File

@ -196,8 +196,8 @@ void NavigationLink3D::_notification(int p_what) {
NavigationServer::get_singleton()->link_set_map(link, get_world_3d()->get_navigation_map());
}
current_global_transform = get_global_transform();
NavigationServer::get_singleton()->link_set_start_location(link, current_global_transform.xform(start_position));
NavigationServer::get_singleton()->link_set_end_location(link, current_global_transform.xform(end_position));
NavigationServer::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
NavigationServer::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
#ifdef DEBUG_ENABLED
_update_debug_mesh();
@ -214,8 +214,8 @@ void NavigationLink3D::_notification(int p_what) {
Transform new_global_transform = get_global_transform();
if (current_global_transform != new_global_transform) {
current_global_transform = new_global_transform;
NavigationServer::get_singleton()->link_set_start_location(link, current_global_transform.xform(start_position));
NavigationServer::get_singleton()->link_set_end_location(link, current_global_transform.xform(end_position));
NavigationServer::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
NavigationServer::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
#ifdef DEBUG_ENABLED
if (debug_instance.is_valid()) {
RS::get_singleton()->instance_set_transform(debug_instance, current_global_transform);
@ -346,7 +346,7 @@ void NavigationLink3D::set_start_position(Vector3 p_position) {
return;
}
NavigationServer::get_singleton()->link_set_start_location(link, current_global_transform.xform(start_position));
NavigationServer::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
#ifdef DEBUG_ENABLED
_update_debug_mesh();
@ -367,7 +367,7 @@ void NavigationLink3D::set_end_position(Vector3 p_position) {
return;
}
NavigationServer::get_singleton()->link_set_end_location(link, current_global_transform.xform(end_position));
NavigationServer::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
#ifdef DEBUG_ENABLED
_update_debug_mesh();

View File

@ -83,10 +83,10 @@ void Navigation2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &Navigation2DServer::link_is_bidirectional);
ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &Navigation2DServer::link_set_navigation_layers);
ClassDB::bind_method(D_METHOD("link_get_navigation_layers", "link"), &Navigation2DServer::link_get_navigation_layers);
ClassDB::bind_method(D_METHOD("link_set_start_location", "link", "location"), &Navigation2DServer::link_set_start_location);
ClassDB::bind_method(D_METHOD("link_get_start_location", "link"), &Navigation2DServer::link_get_start_location);
ClassDB::bind_method(D_METHOD("link_set_end_location", "link", "location"), &Navigation2DServer::link_set_end_location);
ClassDB::bind_method(D_METHOD("link_get_end_location", "link"), &Navigation2DServer::link_get_end_location);
ClassDB::bind_method(D_METHOD("link_set_start_position", "link", "position"), &Navigation2DServer::link_set_start_position);
ClassDB::bind_method(D_METHOD("link_get_start_position", "link"), &Navigation2DServer::link_get_start_position);
ClassDB::bind_method(D_METHOD("link_set_end_position", "link", "position"), &Navigation2DServer::link_set_end_position);
ClassDB::bind_method(D_METHOD("link_get_end_position", "link"), &Navigation2DServer::link_get_end_position);
ClassDB::bind_method(D_METHOD("link_set_enter_cost", "link", "enter_cost"), &Navigation2DServer::link_set_enter_cost);
ClassDB::bind_method(D_METHOD("link_get_enter_cost", "link"), &Navigation2DServer::link_get_enter_cost);
ClassDB::bind_method(D_METHOD("link_set_travel_cost", "link", "travel_cost"), &Navigation2DServer::link_set_travel_cost);

View File

@ -134,7 +134,7 @@ public:
virtual Vector2 region_get_connection_pathway_start(RID p_region, int p_connection_id) const = 0;
virtual Vector2 region_get_connection_pathway_end(RID p_region, int p_connection_id) const = 0;
/// Creates a new link between locations in the nav map.
/// Creates a new link between positions in the nav map.
virtual RID link_create() const = 0;
/// Set the map of this link.
@ -149,13 +149,13 @@ public:
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) const = 0;
virtual uint32_t link_get_navigation_layers(RID p_link) const = 0;
/// Set the start location of the link.
virtual void link_set_start_location(RID p_link, Vector2 p_location) const = 0;
virtual Vector2 link_get_start_location(RID p_link) const = 0;
/// Set the start position of the link.
virtual void link_set_start_position(RID p_link, Vector2 p_position) const = 0;
virtual Vector2 link_get_start_position(RID p_link) const = 0;
/// Set the end location of the link.
virtual void link_set_end_location(RID p_link, Vector2 p_location) const = 0;
virtual Vector2 link_get_end_location(RID p_link) const = 0;
/// Set the end position of the link.
virtual void link_set_end_position(RID p_link, Vector2 p_position) const = 0;
virtual Vector2 link_get_end_position(RID p_link) const = 0;
/// Set the enter cost of the link.
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) const = 0;

View File

@ -102,10 +102,10 @@ void NavigationServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer::link_is_bidirectional);
ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer::link_set_navigation_layers);
ClassDB::bind_method(D_METHOD("link_get_navigation_layers", "link"), &NavigationServer::link_get_navigation_layers);
ClassDB::bind_method(D_METHOD("link_set_start_location", "link", "location"), &NavigationServer::link_set_start_location);
ClassDB::bind_method(D_METHOD("link_get_start_location", "link"), &NavigationServer::link_get_start_location);
ClassDB::bind_method(D_METHOD("link_set_end_location", "link", "location"), &NavigationServer::link_set_end_location);
ClassDB::bind_method(D_METHOD("link_get_end_location", "link"), &NavigationServer::link_get_end_location);
ClassDB::bind_method(D_METHOD("link_set_start_position", "link", "position"), &NavigationServer::link_set_start_position);
ClassDB::bind_method(D_METHOD("link_get_start_position", "link"), &NavigationServer::link_get_start_position);
ClassDB::bind_method(D_METHOD("link_set_end_position", "link", "position"), &NavigationServer::link_set_end_position);
ClassDB::bind_method(D_METHOD("link_get_end_position", "link"), &NavigationServer::link_get_end_position);
ClassDB::bind_method(D_METHOD("link_set_enter_cost", "link", "enter_cost"), &NavigationServer::link_set_enter_cost);
ClassDB::bind_method(D_METHOD("link_get_enter_cost", "link"), &NavigationServer::link_get_enter_cost);
ClassDB::bind_method(D_METHOD("link_set_travel_cost", "link", "travel_cost"), &NavigationServer::link_set_travel_cost);

View File

@ -150,7 +150,7 @@ public:
virtual Vector3 region_get_connection_pathway_start(RID p_region, int p_connection_id) const = 0;
virtual Vector3 region_get_connection_pathway_end(RID p_region, int p_connection_id) const = 0;
/// Creates a new link between locations in the nav map.
/// Creates a new link between positions in the nav map.
virtual RID link_create() const = 0;
/// Set the map of this link.
@ -165,13 +165,13 @@ public:
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) const = 0;
virtual uint32_t link_get_navigation_layers(RID p_link) const = 0;
/// Set the start location of the link.
virtual void link_set_start_location(RID p_link, Vector3 p_location) const = 0;
virtual Vector3 link_get_start_location(RID p_link) const = 0;
/// Set the start position of the link.
virtual void link_set_start_position(RID p_link, Vector3 p_position) const = 0;
virtual Vector3 link_get_start_position(RID p_link) const = 0;
/// Set the end location of the link.
virtual void link_set_end_location(RID p_link, Vector3 p_location) const = 0;
virtual Vector3 link_get_end_location(RID p_link) const = 0;
/// Set the end position of the link.
virtual void link_set_end_position(RID p_link, Vector3 p_position) const = 0;
virtual Vector3 link_get_end_position(RID p_link) const = 0;
/// Set the enter cost of the link.
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) const = 0;