navigation_link_3d.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. /**************************************************************************/
  2. /* navigation_link_3d.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "navigation_link_3d.h"
  31. #include "servers/navigation_server_3d.h"
  32. #ifdef DEBUG_ENABLED
  33. void NavigationLink3D::_update_debug_mesh() {
  34. if (!is_inside_tree()) {
  35. return;
  36. }
  37. if (Engine::get_singleton()->is_editor_hint()) {
  38. // don't update inside Editor as node 3d gizmo takes care of this
  39. // as collisions and selections for Editor Viewport need to be updated
  40. return;
  41. }
  42. if (!NavigationServer3D::get_singleton()->get_debug_navigation_enabled()) {
  43. if (debug_instance.is_valid()) {
  44. RS::get_singleton()->instance_set_visible(debug_instance, false);
  45. }
  46. return;
  47. }
  48. if (!debug_instance.is_valid()) {
  49. debug_instance = RenderingServer::get_singleton()->instance_create();
  50. }
  51. if (debug_mesh.is_null()) {
  52. debug_mesh.instantiate();
  53. }
  54. RID nav_map = get_world_3d()->get_navigation_map();
  55. real_t search_radius = NavigationServer3D::get_singleton()->map_get_link_connection_radius(nav_map);
  56. Vector3 up_vector = NavigationServer3D::get_singleton()->map_get_up(nav_map);
  57. Vector3::Axis up_axis = up_vector.max_axis_index();
  58. debug_mesh->clear_surfaces();
  59. Vector<Vector3> lines;
  60. // Draw line between the points.
  61. lines.push_back(start_position);
  62. lines.push_back(end_position);
  63. // Draw start position search radius
  64. for (int i = 0; i < 30; i++) {
  65. // Create a circle
  66. const float ra = Math::deg_to_rad((float)(i * 12));
  67. const float rb = Math::deg_to_rad((float)((i + 1) * 12));
  68. const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * search_radius;
  69. const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * search_radius;
  70. // Draw axis-aligned circle
  71. switch (up_axis) {
  72. case Vector3::AXIS_X:
  73. lines.append(start_position + Vector3(0, a.x, a.y));
  74. lines.append(start_position + Vector3(0, b.x, b.y));
  75. break;
  76. case Vector3::AXIS_Y:
  77. lines.append(start_position + Vector3(a.x, 0, a.y));
  78. lines.append(start_position + Vector3(b.x, 0, b.y));
  79. break;
  80. case Vector3::AXIS_Z:
  81. lines.append(start_position + Vector3(a.x, a.y, 0));
  82. lines.append(start_position + Vector3(b.x, b.y, 0));
  83. break;
  84. }
  85. }
  86. // Draw end position search radius
  87. for (int i = 0; i < 30; i++) {
  88. // Create a circle
  89. const float ra = Math::deg_to_rad((float)(i * 12));
  90. const float rb = Math::deg_to_rad((float)((i + 1) * 12));
  91. const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * search_radius;
  92. const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * search_radius;
  93. // Draw axis-aligned circle
  94. switch (up_axis) {
  95. case Vector3::AXIS_X:
  96. lines.append(end_position + Vector3(0, a.x, a.y));
  97. lines.append(end_position + Vector3(0, b.x, b.y));
  98. break;
  99. case Vector3::AXIS_Y:
  100. lines.append(end_position + Vector3(a.x, 0, a.y));
  101. lines.append(end_position + Vector3(b.x, 0, b.y));
  102. break;
  103. case Vector3::AXIS_Z:
  104. lines.append(end_position + Vector3(a.x, a.y, 0));
  105. lines.append(end_position + Vector3(b.x, b.y, 0));
  106. break;
  107. }
  108. }
  109. const Vector3 link_segment = end_position - start_position;
  110. const Vector3 up = Vector3(0.0, 1.0, 0.0);
  111. const float arror_len = 0.5;
  112. {
  113. Vector3 anchor = start_position + (link_segment * 0.75);
  114. Vector3 direction = start_position.direction_to(end_position);
  115. Vector3 arrow_dir = direction.cross(up);
  116. lines.push_back(anchor);
  117. lines.push_back(anchor + (arrow_dir - direction) * arror_len);
  118. arrow_dir = -direction.cross(up);
  119. lines.push_back(anchor);
  120. lines.push_back(anchor + (arrow_dir - direction) * arror_len);
  121. }
  122. if (is_bidirectional()) {
  123. Vector3 anchor = start_position + (link_segment * 0.25);
  124. Vector3 direction = end_position.direction_to(start_position);
  125. Vector3 arrow_dir = direction.cross(up);
  126. lines.push_back(anchor);
  127. lines.push_back(anchor + (arrow_dir - direction) * arror_len);
  128. arrow_dir = -direction.cross(up);
  129. lines.push_back(anchor);
  130. lines.push_back(anchor + (arrow_dir - direction) * arror_len);
  131. }
  132. Array mesh_array;
  133. mesh_array.resize(Mesh::ARRAY_MAX);
  134. mesh_array[Mesh::ARRAY_VERTEX] = lines;
  135. debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, mesh_array);
  136. RS::get_singleton()->instance_set_base(debug_instance, debug_mesh->get_rid());
  137. RS::get_singleton()->instance_set_scenario(debug_instance, get_world_3d()->get_scenario());
  138. RS::get_singleton()->instance_set_visible(debug_instance, is_visible_in_tree());
  139. Ref<StandardMaterial3D> link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_material();
  140. Ref<StandardMaterial3D> disabled_link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_disabled_material();
  141. if (enabled) {
  142. RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, link_material->get_rid());
  143. } else {
  144. RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, disabled_link_material->get_rid());
  145. }
  146. RS::get_singleton()->instance_set_transform(debug_instance, current_global_transform);
  147. }
  148. #endif // DEBUG_ENABLED
  149. void NavigationLink3D::_bind_methods() {
  150. ClassDB::bind_method(D_METHOD("get_rid"), &NavigationLink3D::get_rid);
  151. ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationLink3D::set_enabled);
  152. ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationLink3D::is_enabled);
  153. ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationLink3D::set_navigation_map);
  154. ClassDB::bind_method(D_METHOD("get_navigation_map"), &NavigationLink3D::get_navigation_map);
  155. ClassDB::bind_method(D_METHOD("set_bidirectional", "bidirectional"), &NavigationLink3D::set_bidirectional);
  156. ClassDB::bind_method(D_METHOD("is_bidirectional"), &NavigationLink3D::is_bidirectional);
  157. ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &NavigationLink3D::set_navigation_layers);
  158. ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationLink3D::get_navigation_layers);
  159. ClassDB::bind_method(D_METHOD("set_navigation_layer_value", "layer_number", "value"), &NavigationLink3D::set_navigation_layer_value);
  160. ClassDB::bind_method(D_METHOD("get_navigation_layer_value", "layer_number"), &NavigationLink3D::get_navigation_layer_value);
  161. ClassDB::bind_method(D_METHOD("set_start_position", "position"), &NavigationLink3D::set_start_position);
  162. ClassDB::bind_method(D_METHOD("get_start_position"), &NavigationLink3D::get_start_position);
  163. ClassDB::bind_method(D_METHOD("set_end_position", "position"), &NavigationLink3D::set_end_position);
  164. ClassDB::bind_method(D_METHOD("get_end_position"), &NavigationLink3D::get_end_position);
  165. ClassDB::bind_method(D_METHOD("set_global_start_position", "position"), &NavigationLink3D::set_global_start_position);
  166. ClassDB::bind_method(D_METHOD("get_global_start_position"), &NavigationLink3D::get_global_start_position);
  167. ClassDB::bind_method(D_METHOD("set_global_end_position", "position"), &NavigationLink3D::set_global_end_position);
  168. ClassDB::bind_method(D_METHOD("get_global_end_position"), &NavigationLink3D::get_global_end_position);
  169. ClassDB::bind_method(D_METHOD("set_enter_cost", "enter_cost"), &NavigationLink3D::set_enter_cost);
  170. ClassDB::bind_method(D_METHOD("get_enter_cost"), &NavigationLink3D::get_enter_cost);
  171. ClassDB::bind_method(D_METHOD("set_travel_cost", "travel_cost"), &NavigationLink3D::set_travel_cost);
  172. ClassDB::bind_method(D_METHOD("get_travel_cost"), &NavigationLink3D::get_travel_cost);
  173. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
  174. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bidirectional"), "set_bidirectional", "is_bidirectional");
  175. ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_3D_NAVIGATION), "set_navigation_layers", "get_navigation_layers");
  176. ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "start_position"), "set_start_position", "get_start_position");
  177. ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "end_position"), "set_end_position", "get_end_position");
  178. ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "enter_cost"), "set_enter_cost", "get_enter_cost");
  179. ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "travel_cost"), "set_travel_cost", "get_travel_cost");
  180. }
  181. #ifndef DISABLE_DEPRECATED
  182. bool NavigationLink3D::_set(const StringName &p_name, const Variant &p_value) {
  183. if (p_name == "start_location") {
  184. set_start_position(p_value);
  185. return true;
  186. }
  187. if (p_name == "end_location") {
  188. set_end_position(p_value);
  189. return true;
  190. }
  191. return false;
  192. }
  193. bool NavigationLink3D::_get(const StringName &p_name, Variant &r_ret) const {
  194. if (p_name == "start_location") {
  195. r_ret = get_start_position();
  196. return true;
  197. }
  198. if (p_name == "end_location") {
  199. r_ret = get_end_position();
  200. return true;
  201. }
  202. return false;
  203. }
  204. #endif // DISABLE_DEPRECATED
  205. void NavigationLink3D::_notification(int p_what) {
  206. switch (p_what) {
  207. case NOTIFICATION_ENTER_TREE: {
  208. _link_enter_navigation_map();
  209. } break;
  210. case NOTIFICATION_TRANSFORM_CHANGED: {
  211. set_physics_process_internal(true);
  212. } break;
  213. case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
  214. set_physics_process_internal(false);
  215. _link_update_transform();
  216. } break;
  217. case NOTIFICATION_EXIT_TREE: {
  218. _link_exit_navigation_map();
  219. } break;
  220. }
  221. }
  222. NavigationLink3D::NavigationLink3D() {
  223. link = NavigationServer3D::get_singleton()->link_create();
  224. NavigationServer3D::get_singleton()->link_set_owner_id(link, get_instance_id());
  225. NavigationServer3D::get_singleton()->link_set_enter_cost(link, enter_cost);
  226. NavigationServer3D::get_singleton()->link_set_travel_cost(link, travel_cost);
  227. NavigationServer3D::get_singleton()->link_set_navigation_layers(link, navigation_layers);
  228. NavigationServer3D::get_singleton()->link_set_bidirectional(link, bidirectional);
  229. NavigationServer3D::get_singleton()->link_set_enabled(link, enabled);
  230. set_notify_transform(true);
  231. }
  232. NavigationLink3D::~NavigationLink3D() {
  233. ERR_FAIL_NULL(NavigationServer3D::get_singleton());
  234. NavigationServer3D::get_singleton()->free(link);
  235. link = RID();
  236. #ifdef DEBUG_ENABLED
  237. ERR_FAIL_NULL(RenderingServer::get_singleton());
  238. if (debug_instance.is_valid()) {
  239. RenderingServer::get_singleton()->free(debug_instance);
  240. }
  241. if (debug_mesh.is_valid()) {
  242. RenderingServer::get_singleton()->free(debug_mesh->get_rid());
  243. }
  244. #endif // DEBUG_ENABLED
  245. }
  246. RID NavigationLink3D::get_rid() const {
  247. return link;
  248. }
  249. void NavigationLink3D::set_enabled(bool p_enabled) {
  250. if (enabled == p_enabled) {
  251. return;
  252. }
  253. enabled = p_enabled;
  254. NavigationServer3D::get_singleton()->link_set_enabled(link, enabled);
  255. #ifdef DEBUG_ENABLED
  256. if (debug_instance.is_valid() && debug_mesh.is_valid()) {
  257. if (enabled) {
  258. Ref<StandardMaterial3D> link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_material();
  259. RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, link_material->get_rid());
  260. } else {
  261. Ref<StandardMaterial3D> disabled_link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_disabled_material();
  262. RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, disabled_link_material->get_rid());
  263. }
  264. }
  265. #endif // DEBUG_ENABLED
  266. update_gizmos();
  267. }
  268. void NavigationLink3D::set_navigation_map(RID p_navigation_map) {
  269. if (map_override == p_navigation_map) {
  270. return;
  271. }
  272. map_override = p_navigation_map;
  273. NavigationServer3D::get_singleton()->link_set_map(link, map_override);
  274. }
  275. RID NavigationLink3D::get_navigation_map() const {
  276. if (map_override.is_valid()) {
  277. return map_override;
  278. } else if (is_inside_tree()) {
  279. return get_world_3d()->get_navigation_map();
  280. }
  281. return RID();
  282. }
  283. void NavigationLink3D::set_bidirectional(bool p_bidirectional) {
  284. if (bidirectional == p_bidirectional) {
  285. return;
  286. }
  287. bidirectional = p_bidirectional;
  288. NavigationServer3D::get_singleton()->link_set_bidirectional(link, bidirectional);
  289. #ifdef DEBUG_ENABLED
  290. _update_debug_mesh();
  291. #endif // DEBUG_ENABLED
  292. update_gizmos();
  293. }
  294. void NavigationLink3D::set_navigation_layers(uint32_t p_navigation_layers) {
  295. if (navigation_layers == p_navigation_layers) {
  296. return;
  297. }
  298. navigation_layers = p_navigation_layers;
  299. NavigationServer3D::get_singleton()->link_set_navigation_layers(link, navigation_layers);
  300. }
  301. void NavigationLink3D::set_navigation_layer_value(int p_layer_number, bool p_value) {
  302. ERR_FAIL_COND_MSG(p_layer_number < 1, "Navigation layer number must be between 1 and 32 inclusive.");
  303. ERR_FAIL_COND_MSG(p_layer_number > 32, "Navigation layer number must be between 1 and 32 inclusive.");
  304. uint32_t _navigation_layers = get_navigation_layers();
  305. if (p_value) {
  306. _navigation_layers |= 1 << (p_layer_number - 1);
  307. } else {
  308. _navigation_layers &= ~(1 << (p_layer_number - 1));
  309. }
  310. set_navigation_layers(_navigation_layers);
  311. }
  312. bool NavigationLink3D::get_navigation_layer_value(int p_layer_number) const {
  313. ERR_FAIL_COND_V_MSG(p_layer_number < 1, false, "Navigation layer number must be between 1 and 32 inclusive.");
  314. ERR_FAIL_COND_V_MSG(p_layer_number > 32, false, "Navigation layer number must be between 1 and 32 inclusive.");
  315. return get_navigation_layers() & (1 << (p_layer_number - 1));
  316. }
  317. void NavigationLink3D::set_start_position(Vector3 p_position) {
  318. if (start_position.is_equal_approx(p_position)) {
  319. return;
  320. }
  321. start_position = p_position;
  322. if (!is_inside_tree()) {
  323. return;
  324. }
  325. NavigationServer3D::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
  326. #ifdef DEBUG_ENABLED
  327. _update_debug_mesh();
  328. #endif // DEBUG_ENABLED
  329. update_gizmos();
  330. update_configuration_warnings();
  331. }
  332. void NavigationLink3D::set_end_position(Vector3 p_position) {
  333. if (end_position.is_equal_approx(p_position)) {
  334. return;
  335. }
  336. end_position = p_position;
  337. if (!is_inside_tree()) {
  338. return;
  339. }
  340. NavigationServer3D::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
  341. #ifdef DEBUG_ENABLED
  342. _update_debug_mesh();
  343. #endif // DEBUG_ENABLED
  344. update_gizmos();
  345. update_configuration_warnings();
  346. }
  347. void NavigationLink3D::set_global_start_position(Vector3 p_position) {
  348. if (is_inside_tree()) {
  349. set_start_position(to_local(p_position));
  350. } else {
  351. set_start_position(p_position);
  352. }
  353. }
  354. Vector3 NavigationLink3D::get_global_start_position() const {
  355. if (is_inside_tree()) {
  356. return to_global(start_position);
  357. } else {
  358. return start_position;
  359. }
  360. }
  361. void NavigationLink3D::set_global_end_position(Vector3 p_position) {
  362. if (is_inside_tree()) {
  363. set_end_position(to_local(p_position));
  364. } else {
  365. set_end_position(p_position);
  366. }
  367. }
  368. Vector3 NavigationLink3D::get_global_end_position() const {
  369. if (is_inside_tree()) {
  370. return to_global(end_position);
  371. } else {
  372. return end_position;
  373. }
  374. }
  375. void NavigationLink3D::set_enter_cost(real_t p_enter_cost) {
  376. ERR_FAIL_COND_MSG(p_enter_cost < 0.0, "The enter_cost must be positive.");
  377. if (Math::is_equal_approx(enter_cost, p_enter_cost)) {
  378. return;
  379. }
  380. enter_cost = p_enter_cost;
  381. NavigationServer3D::get_singleton()->link_set_enter_cost(link, enter_cost);
  382. }
  383. void NavigationLink3D::set_travel_cost(real_t p_travel_cost) {
  384. ERR_FAIL_COND_MSG(p_travel_cost < 0.0, "The travel_cost must be positive.");
  385. if (Math::is_equal_approx(travel_cost, p_travel_cost)) {
  386. return;
  387. }
  388. travel_cost = p_travel_cost;
  389. NavigationServer3D::get_singleton()->link_set_travel_cost(link, travel_cost);
  390. }
  391. PackedStringArray NavigationLink3D::get_configuration_warnings() const {
  392. PackedStringArray warnings = Node3D::get_configuration_warnings();
  393. if (start_position.is_equal_approx(end_position)) {
  394. warnings.push_back(RTR("NavigationLink3D start position should be different than the end position to be useful."));
  395. }
  396. return warnings;
  397. }
  398. void NavigationLink3D::_link_enter_navigation_map() {
  399. if (!is_inside_tree()) {
  400. return;
  401. }
  402. if (map_override.is_valid()) {
  403. NavigationServer3D::get_singleton()->link_set_map(link, map_override);
  404. } else {
  405. NavigationServer3D::get_singleton()->link_set_map(link, get_world_3d()->get_navigation_map());
  406. }
  407. current_global_transform = get_global_transform();
  408. NavigationServer3D::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
  409. NavigationServer3D::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
  410. NavigationServer3D::get_singleton()->link_set_enabled(link, enabled);
  411. #ifdef DEBUG_ENABLED
  412. if (NavigationServer3D::get_singleton()->get_debug_navigation_enabled()) {
  413. _update_debug_mesh();
  414. }
  415. #endif // DEBUG_ENABLED
  416. }
  417. void NavigationLink3D::_link_exit_navigation_map() {
  418. NavigationServer3D::get_singleton()->link_set_map(link, RID());
  419. #ifdef DEBUG_ENABLED
  420. if (debug_instance.is_valid()) {
  421. RS::get_singleton()->instance_set_visible(debug_instance, false);
  422. }
  423. #endif // DEBUG_ENABLED
  424. }
  425. void NavigationLink3D::_link_update_transform() {
  426. if (!is_inside_tree()) {
  427. return;
  428. }
  429. Transform3D new_global_transform = get_global_transform();
  430. if (current_global_transform != new_global_transform) {
  431. current_global_transform = new_global_transform;
  432. NavigationServer3D::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position));
  433. NavigationServer3D::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position));
  434. #ifdef DEBUG_ENABLED
  435. if (NavigationServer3D::get_singleton()->get_debug_navigation_enabled()) {
  436. _update_debug_mesh();
  437. }
  438. #endif // DEBUG_ENABLED
  439. }
  440. }