Browse Source

Merge pull request #57013 from Killfrra/3.x

[3.x] Backport method `get_rid` for NavigationAgent
Rémi Verschelde 3 years ago
parent
commit
40a348bce2

+ 6 - 0
doc/classes/NavigationAgent.xml

@@ -45,6 +45,12 @@
 				Returns a [Vector3] 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 origin of the agent's parent.
 				Returns a [Vector3] 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 origin of the agent's parent.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="get_rid" qualifiers="const">
+			<return type="RID" />
+			<description>
+				Returns the object's [RID].
+			</description>
+		</method>
 		<method name="get_target_location" qualifiers="const">
 		<method name="get_target_location" qualifiers="const">
 			<return type="Vector3" />
 			<return type="Vector3" />
 			<description>
 			<description>

+ 6 - 0
doc/classes/NavigationAgent2D.xml

@@ -45,6 +45,12 @@
 				Returns a [Vector2] 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.
 				Returns a [Vector2] 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.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="get_rid" qualifiers="const">
+			<return type="RID" />
+			<description>
+				Returns the object's [RID].
+			</description>
+		</method>
 		<method name="get_target_location" qualifiers="const">
 		<method name="get_target_location" qualifiers="const">
 			<return type="Vector2" />
 			<return type="Vector2" />
 			<description>
 			<description>

+ 2 - 0
scene/2d/navigation_agent_2d.cpp

@@ -35,6 +35,8 @@
 #include "servers/navigation_2d_server.h"
 #include "servers/navigation_2d_server.h"
 
 
 void NavigationAgent2D::_bind_methods() {
 void NavigationAgent2D::_bind_methods() {
+	ClassDB::bind_method(D_METHOD("get_rid"), &NavigationAgent2D::get_rid);
+
 	ClassDB::bind_method(D_METHOD("set_target_desired_distance", "desired_distance"), &NavigationAgent2D::set_target_desired_distance);
 	ClassDB::bind_method(D_METHOD("set_target_desired_distance", "desired_distance"), &NavigationAgent2D::set_target_desired_distance);
 	ClassDB::bind_method(D_METHOD("get_target_desired_distance"), &NavigationAgent2D::get_target_desired_distance);
 	ClassDB::bind_method(D_METHOD("get_target_desired_distance"), &NavigationAgent2D::get_target_desired_distance);
 
 

+ 2 - 0
scene/3d/navigation_agent.cpp

@@ -35,6 +35,8 @@
 #include "servers/navigation_server.h"
 #include "servers/navigation_server.h"
 
 
 void NavigationAgent::_bind_methods() {
 void NavigationAgent::_bind_methods() {
+	ClassDB::bind_method(D_METHOD("get_rid"), &NavigationAgent::get_rid);
+
 	ClassDB::bind_method(D_METHOD("set_target_desired_distance", "desired_distance"), &NavigationAgent::set_target_desired_distance);
 	ClassDB::bind_method(D_METHOD("set_target_desired_distance", "desired_distance"), &NavigationAgent::set_target_desired_distance);
 	ClassDB::bind_method(D_METHOD("get_target_desired_distance"), &NavigationAgent::get_target_desired_distance);
 	ClassDB::bind_method(D_METHOD("get_target_desired_distance"), &NavigationAgent::get_target_desired_distance);