@@ -21,7 +21,6 @@ use crate::{
2121} ;
2222use bevy:: {
2323 camera:: visibility:: VisibilitySystems ,
24- color:: palettes:: css:: WHITE ,
2524 ecs:: {
2625 query:: Has ,
2726 system:: { StaticSystemParam , SystemParam , SystemParamItem } ,
@@ -43,6 +42,7 @@ use bevy::{
4342/// - [`RayCaster`]
4443/// - [`ShapeCaster`]
4544/// - [Simulation islands](dynamics::solver::islands)
45+ /// - [Collider tree](crate::collider_tree) nodes
4646/// - Changing the visibility of entities to only show debug rendering
4747///
4848/// By default, [AABBs](ColliderAabb) and [contacts](ContactPair) are not debug rendered.
@@ -253,13 +253,23 @@ fn debug_render_aabbs(
253253 }
254254}
255255
256- fn debug_render_bvh ( bvh : Res < ColliderTrees > , mut gizmos : Gizmos < PhysicsGizmos > ) {
256+ fn debug_render_bvh (
257+ bvh : Res < ColliderTrees > ,
258+ mut gizmos : Gizmos < PhysicsGizmos > ,
259+ store : Res < GizmoConfigStore > ,
260+ ) {
261+ let config = store. config :: < PhysicsGizmos > ( ) . 1 ;
262+
263+ let Some ( collider_tree_color) = config. collider_tree_color else {
264+ return ;
265+ } ;
266+
257267 for node in bvh. dynamic_tree . bvh . nodes . iter ( ) {
258268 if node. prim_count == 0 && node. aabb . valid ( ) {
259269 gizmos. aabb_3d (
260270 Aabb3d :: from_min_max ( node. aabb . min , node. aabb . max ) ,
261271 Transform :: IDENTITY ,
262- WHITE ,
272+ collider_tree_color ,
263273 ) ;
264274 }
265275 }
@@ -268,7 +278,7 @@ fn debug_render_bvh(bvh: Res<ColliderTrees>, mut gizmos: Gizmos<PhysicsGizmos>)
268278 gizmos. aabb_3d (
269279 Aabb3d :: from_min_max ( node. aabb . min , node. aabb . max ) ,
270280 Transform :: IDENTITY ,
271- WHITE ,
281+ collider_tree_color ,
272282 ) ;
273283 }
274284 }
0 commit comments