From c11500d480e7fc32614910eb3708ca04cb265dfe Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 9 Jun 2023 10:28:31 +0200 Subject: [PATCH] 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 https://github.com/godotengine/godot/commit/bf1571979cd3cd90b2b5c4581b2947450aa4cd9d --- doc/classes/Navigation2DServer.xml | 22 ++++---- doc/classes/NavigationAgent.xml | 32 ++++++------ doc/classes/NavigationAgent2D.xml | 32 ++++++------ doc/classes/NavigationLink3D.xml | 2 +- doc/classes/NavigationServer.xml | 22 ++++---- editor/spatial_editor_gizmos.cpp | 50 +++++++++---------- modules/navigation/nav_utils.h | 2 +- .../pandemonium_navigation_2d_server.cpp | 8 +-- .../pandemonium_navigation_2d_server.h | 14 +++--- .../pandemonium_navigation_server.cpp | 12 ++--- .../pandemonium_navigation_server.h | 8 +-- .../dummy_navigation_2d_server.h | 8 +-- .../dummy_navigation_server.h | 8 +-- scene/2d/navigation_agent_2d.cpp | 34 ++++++------- scene/2d/navigation_agent_2d.h | 10 ++-- scene/2d/navigation_link_2d.cpp | 12 ++--- scene/3d/navigation_agent.cpp | 34 ++++++------- scene/3d/navigation_agent.h | 10 ++-- scene/3d/navigation_link_3d.cpp | 12 ++--- servers/navigation_2d_server.cpp | 8 +-- servers/navigation_2d_server.h | 14 +++--- servers/navigation_server.cpp | 8 +-- servers/navigation_server.h | 14 +++--- 23 files changed, 188 insertions(+), 188 deletions(-) diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/Navigation2DServer.xml index 088964569..0a5ef4ba9 100644 --- a/doc/classes/Navigation2DServer.xml +++ b/doc/classes/Navigation2DServer.xml @@ -142,14 +142,14 @@ - Create a new link between two locations on a map. + Create a new link between two positions on a map. - + - Returns the ending location of this [code]link[/code]. + Returns the ending position of this [code]link[/code]. @@ -173,11 +173,11 @@ Returns the navigation layers for this [code]link[/code]. - + - Returns the starting location of this [code]link[/code]. + Returns the starting position of this [code]link[/code]. @@ -202,12 +202,12 @@ Sets whether this [code]link[/code] can be travelled in both directions. - + - + - Sets the exit location for the [code]link[/code]. + Sets the exit position for the [code]link[/code]. @@ -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]). - + - + - Sets the entry location for this [code]link[/code]. + Sets the entry position for this [code]link[/code]. diff --git a/doc/classes/NavigationAgent.xml b/doc/classes/NavigationAgent.xml index f2d13d879..32660583e 100644 --- a/doc/classes/NavigationAgent.xml +++ b/doc/classes/NavigationAgent.xml @@ -4,8 +4,8 @@ 3D agent used in navigation for collision avoidance. - 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. @@ -14,19 +14,19 @@ - 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. - + - 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. - 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. @@ -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. - + - 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. @@ -62,19 +62,19 @@ - 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. - Returns [code]true[/code] if [member target_location] is reachable. + Returns [code]true[/code] if [member target_position] is reachable. - 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]. @@ -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. - 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. 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 @@ 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. - - The user-defined target location. Setting this property will clear the current navigation path. + + The user-defined target position. Setting this property will clear the current navigation path. 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 @@ - Notifies when the final location is reached. + Notifies when the final position is reached. @@ -154,7 +154,7 @@ - Notifies when the player-defined [member target_location] is reached. + Notifies when the player-defined [member target_position] is reached. diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml index 33d0622a7..f86990ba0 100644 --- a/doc/classes/NavigationAgent2D.xml +++ b/doc/classes/NavigationAgent2D.xml @@ -4,8 +4,8 @@ 2D agent used in navigation for collision avoidance. - 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. @@ -14,19 +14,19 @@ - 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. - + - 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. - 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. @@ -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. - + - 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. @@ -62,19 +62,19 @@ - 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. - Returns [code]true[/code] if [member target_location] is reachable. + Returns [code]true[/code] if [member target_position] is reachable. - 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]. @@ -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. - 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. 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 @@ 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. - - The user-defined target location. Setting this property will clear the current navigation path. + + The user-defined target position. Setting this property will clear the current navigation path. 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 @@ - Notifies when the final location is reached. + Notifies when the final position is reached. @@ -148,7 +148,7 @@ - Notifies when the player-defined [member target_location] is reached. + Notifies when the player-defined [member target_position] is reached. diff --git a/doc/classes/NavigationLink3D.xml b/doc/classes/NavigationLink3D.xml index 1ef59305e..128648ba2 100644 --- a/doc/classes/NavigationLink3D.xml +++ b/doc/classes/NavigationLink3D.xml @@ -1,5 +1,5 @@ - + A link between two positions on [NavigationRegion3D]s that agents can be routed through. diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer.xml index cd80869c7..3b355d9ba 100644 --- a/doc/classes/NavigationServer.xml +++ b/doc/classes/NavigationServer.xml @@ -150,14 +150,14 @@ - Create a new link between two locations on a map. + Create a new link between two positions on a map. - + - Returns the ending location of this [code]link[/code]. + Returns the ending position of this [code]link[/code]. @@ -181,11 +181,11 @@ Returns the navigation layers for this [code]link[/code]. - + - Returns the starting location of this [code]link[/code]. + Returns the starting position of this [code]link[/code]. @@ -210,12 +210,12 @@ Sets whether this [code]link[/code] can be travelled in both directions. - + - + - Sets the exit location for the [code]link[/code]. + Sets the exit position for the [code]link[/code]. @@ -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]). - + - + - Sets the entry location for this [code]link[/code]. + Sets the entry position for this [code]link[/code]. diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 81f8da22b..0d79e74db 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -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(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 link_material = get_material("navigation_link_material", p_gizmo); Ref 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 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 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); } } diff --git a/modules/navigation/nav_utils.h b/modules/navigation/nav_utils.h index 6c91b23f7..ff52026a9 100644 --- a/modules/navigation/nav_utils.h +++ b/modules/navigation/nav_utils.h @@ -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; diff --git a/modules/navigation/pandemonium_navigation_2d_server.cpp b/modules/navigation/pandemonium_navigation_2d_server.cpp index a37cfe85a..512681ca6 100644 --- a/modules/navigation/pandemonium_navigation_2d_server.cpp +++ b/modules/navigation/pandemonium_navigation_2d_server.cpp @@ -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); diff --git a/modules/navigation/pandemonium_navigation_2d_server.h b/modules/navigation/pandemonium_navigation_2d_server.h index 0a49d009f..067f729a8 100644 --- a/modules/navigation/pandemonium_navigation_2d_server.h +++ b/modules/navigation/pandemonium_navigation_2d_server.h @@ -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; diff --git a/modules/navigation/pandemonium_navigation_server.cpp b/modules/navigation/pandemonium_navigation_server.cpp index 5dc83eec3..6fe0b6fb8 100644 --- a/modules/navigation/pandemonium_navigation_server.cpp +++ b/modules/navigation/pandemonium_navigation_server.cpp @@ -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()); diff --git a/modules/navigation/pandemonium_navigation_server.h b/modules/navigation/pandemonium_navigation_server.h index 20d3e865a..d151c789b 100644 --- a/modules/navigation/pandemonium_navigation_server.h +++ b/modules/navigation/pandemonium_navigation_server.h @@ -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); diff --git a/modules/navigation_dummy/dummy_navigation_2d_server.h b/modules/navigation_dummy/dummy_navigation_2d_server.h index 00aaeabc4..14a73caca 100644 --- a/modules/navigation_dummy/dummy_navigation_2d_server.h +++ b/modules/navigation_dummy/dummy_navigation_2d_server.h @@ -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 {} diff --git a/modules/navigation_dummy/dummy_navigation_server.h b/modules/navigation_dummy/dummy_navigation_server.h index 9032bd152..c3a64c115 100644 --- a/modules/navigation_dummy/dummy_navigation_server.h +++ b/modules/navigation_dummy/dummy_navigation_server.h @@ -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 {} diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index 9e44f24bf..5625cea7a 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -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()) { diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h index f5b5820df..17687c2e0 100644 --- a/scene/2d/navigation_agent_2d.h +++ b/scene/2d/navigation_agent_2d.h @@ -58,7 +58,7 @@ class NavigationAgent2D : public Node { real_t path_max_distance; - Vector2 target_location; + Vector2 target_position; Vector 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 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); diff --git a/scene/2d/navigation_link_2d.cpp b/scene/2d/navigation_link_2d.cpp index 607f377a3..981c8e229 100644 --- a/scene/2d/navigation_link_2d.cpp +++ b/scene/2d/navigation_link_2d.cpp @@ -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(); diff --git a/scene/3d/navigation_agent.cpp b/scene/3d/navigation_agent.cpp index c5b76a0ad..79d98f137 100644 --- a/scene/3d/navigation_agent.cpp +++ b/scene/3d/navigation_agent.cpp @@ -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()) { diff --git a/scene/3d/navigation_agent.h b/scene/3d/navigation_agent.h index ec8b5e417..dae0facce 100644 --- a/scene/3d/navigation_agent.h +++ b/scene/3d/navigation_agent.h @@ -61,7 +61,7 @@ class NavigationAgent : public Node { real_t path_max_distance; - Vector3 target_location; + Vector3 target_position; Vector 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 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); diff --git a/scene/3d/navigation_link_3d.cpp b/scene/3d/navigation_link_3d.cpp index f417b199e..a49bbc4f7 100644 --- a/scene/3d/navigation_link_3d.cpp +++ b/scene/3d/navigation_link_3d.cpp @@ -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(); diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp index 845c632da..fe66c5b14 100644 --- a/servers/navigation_2d_server.cpp +++ b/servers/navigation_2d_server.cpp @@ -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); diff --git a/servers/navigation_2d_server.h b/servers/navigation_2d_server.h index fd32a93bc..3f6e067ea 100644 --- a/servers/navigation_2d_server.h +++ b/servers/navigation_2d_server.h @@ -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; diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp index 8da8c79a5..fcc6f3b6c 100644 --- a/servers/navigation_server.cpp +++ b/servers/navigation_server.cpp @@ -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); diff --git a/servers/navigation_server.h b/servers/navigation_server.h index 7006e6b10..78dc8198c 100644 --- a/servers/navigation_server.h +++ b/servers/navigation_server.h @@ -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;