summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-02 18:24:30 +0200
committerGitHub <noreply@github.com>2022-06-02 18:24:30 +0200
commit93bbbf8947de307191804b7c183b81dc4d19e894 (patch)
tree035fb27f7bbdd40329d465d1f5e200e4e2f06e5a
parent52e36ab80edf1818bc35901fff1079be8ba37cfd (diff)
parentb6eff47bac0a2745da6e3aa95ffa340eb71c7248 (diff)
Merge pull request #61625 from smix8/navigation_debugview_mesh_scripted_4.x
-rw-r--r--scene/3d/navigation_region_3d.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index 6404432631..cb8da182ee 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -131,6 +131,17 @@ void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmes
NavigationServer3D::get_singleton()->region_set_navmesh(region, p_navmesh);
+ if (debug_view == nullptr && is_inside_tree() && navmesh.is_valid() && get_tree()->is_debugging_navigation_hint()) {
+ MeshInstance3D *dm = memnew(MeshInstance3D);
+ dm->set_mesh(navmesh->get_debug_mesh());
+ if (is_enabled()) {
+ dm->set_material_override(get_tree()->get_debug_navigation_material());
+ } else {
+ dm->set_material_override(get_tree()->get_debug_navigation_disabled_material());
+ }
+ add_child(dm);
+ debug_view = dm;
+ }
if (debug_view && navmesh.is_valid()) {
Object::cast_to<MeshInstance3D>(debug_view)->set_mesh(navmesh->get_debug_mesh());
}