summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/navigation_2d_server.cpp11
-rw-r--r--servers/navigation_2d_server.h3
-rw-r--r--servers/navigation_server.cpp4
-rw-r--r--servers/navigation_server.h5
4 files changed, 23 insertions, 0 deletions
diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp
index 94ddecf9c3..d9b53122e2 100644
--- a/servers/navigation_2d_server.cpp
+++ b/servers/navigation_2d_server.cpp
@@ -62,6 +62,12 @@ Navigation2DServer *Navigation2DServer::singleton = NULL;
return NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1)); \
}
+#define FORWARD_2_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, CONV_0, CONV_1) \
+ Navigation2DServer::FUNC_NAME(T_0 D_0, T_1 D_1) \
+ const { \
+ return CONV_R(NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1))); \
+ }
+
#define FORWARD_4_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
Navigation2DServer::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
const { \
@@ -132,6 +138,8 @@ void Navigation2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &Navigation2DServer::map_set_edge_connection_margin);
ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &Navigation2DServer::map_get_edge_connection_margin);
ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize"), &Navigation2DServer::map_get_path);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &Navigation2DServer::map_get_closest_point);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &Navigation2DServer::map_get_closest_point_owner);
ClassDB::bind_method(D_METHOD("region_create"), &Navigation2DServer::region_create);
ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &Navigation2DServer::region_set_map);
@@ -176,6 +184,9 @@ real_t FORWARD_1_C(map_get_edge_connection_margin, RID, p_map, rid_to_rid);
Vector<Vector2> FORWARD_4_R_C(vector_v3_to_v2, map_get_path, RID, p_map, Vector2, p_origin, Vector2, p_destination, bool, p_optimize, rid_to_rid, v2_to_v3, v2_to_v3, bool_to_bool);
+Vector2 FORWARD_2_R_C(v3_to_v2, map_get_closest_point, RID, p_map, const Vector2 &, p_point, rid_to_rid, v2_to_v3);
+RID FORWARD_2_C(map_get_closest_point_owner, RID, p_map, const Vector2 &, p_point, rid_to_rid, v2_to_v3);
+
RID FORWARD_0_C(region_create);
void FORWARD_2_C(region_set_map, RID, p_region, RID, p_map, rid_to_rid, rid_to_rid);
diff --git a/servers/navigation_2d_server.h b/servers/navigation_2d_server.h
index 2ac0e8f875..955b0c3726 100644
--- a/servers/navigation_2d_server.h
+++ b/servers/navigation_2d_server.h
@@ -79,6 +79,9 @@ public:
/// Returns the navigation path to reach the destination from the origin.
virtual Vector<Vector2> map_get_path(RID p_map, Vector2 p_origin, Vector2 p_destination, bool p_optimize) const;
+ virtual Vector2 map_get_closest_point(RID p_map, const Vector2 &p_point) const;
+ virtual RID map_get_closest_point_owner(RID p_map, const Vector2 &p_point) const;
+
/// Creates a new region.
virtual RID region_create() const;
diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp
index d28aed9110..f31795fb35 100644
--- a/servers/navigation_server.cpp
+++ b/servers/navigation_server.cpp
@@ -48,6 +48,10 @@ void NavigationServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &NavigationServer::map_set_edge_connection_margin);
ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &NavigationServer::map_get_edge_connection_margin);
ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize"), &NavigationServer::map_get_path);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_to_segment", "map", "start", "end", "use_collision"), &NavigationServer::map_get_closest_point_to_segment, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &NavigationServer::map_get_closest_point);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_normal", "map", "to_point"), &NavigationServer::map_get_closest_point_normal);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &NavigationServer::map_get_closest_point_owner);
ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer::region_create);
ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer::region_set_map);
diff --git a/servers/navigation_server.h b/servers/navigation_server.h
index bcdbf84339..d4d95d72d4 100644
--- a/servers/navigation_server.h
+++ b/servers/navigation_server.h
@@ -90,6 +90,11 @@ public:
/// Returns the navigation path to reach the destination from the origin.
virtual Vector<Vector3> map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize) const = 0;
+ virtual Vector3 map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision = false) const = 0;
+ virtual Vector3 map_get_closest_point(RID p_map, const Vector3 &p_point) const = 0;
+ virtual Vector3 map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const = 0;
+ virtual RID map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const = 0;
+
/// Creates a new region.
virtual RID region_create() const = 0;