From 92c40bcf325ce91279c14f0b6a42c200fe4faf51 Mon Sep 17 00:00:00 2001 From: Josh Jones Date: Sat, 6 Aug 2022 23:54:57 -0700 Subject: Fix NavigationRegion3D gizmo's odd visual behavior --- scene/3d/navigation_region_3d.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scene/3d/navigation_region_3d.cpp') diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 0abb0e8dea..bcbc829c5f 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -418,11 +418,14 @@ void NavigationRegion3D::_update_debug_mesh() { Ref face_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_material(); Ref line_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_material(); + RandomPCG rand; Color polygon_color = debug_navigation_geometry_face_color; for (int i = 0; i < polygon_count; i++) { if (enabled_geometry_face_random_color) { - polygon_color = debug_navigation_geometry_face_color * (Color(Math::randf(), Math::randf(), Math::randf())); + // Generate the polygon color, slightly randomly modified from the settings one. + polygon_color.set_hsv(debug_navigation_geometry_face_color.get_h() + rand.random(-1.0, 1.0) * 0.1, debug_navigation_geometry_face_color.get_s(), debug_navigation_geometry_face_color.get_v() + rand.random(-1.0, 1.0) * 0.2); + polygon_color.a = debug_navigation_geometry_face_color.a; } Vector polygon = navmesh->get_polygon(i); -- cgit v1.2.3