Skip to content

Granular configuration of debug render systems#977

Open
barsoosayque wants to merge 3 commits into
avianphysics:mainfrom
barsoosayque:debug-settings
Open

Granular configuration of debug render systems#977
barsoosayque wants to merge 3 commits into
avianphysics:mainfrom
barsoosayque:debug-settings

Conversation

@barsoosayque
Copy link
Copy Markdown

Objective

  • Enable/disable debug render systems via run_if conditions.
  • Configure what parts of the physics should be rendered, e.g. only colliders and body axes.
  • Can be configured both in runtime and before the app start.

Solution

New resource PhysicsDebugRenderConfig with a bunch of bools for each group of render debug systems. By default, everything is enabled.

Alternative solution is to cram everything into PhysicsGizmos, but I think it's big enough already ?

Testing

I tested this with cargo run --example move_and_slide_3d --features use-debug-plugin and toggling colliders rendering:

index 113216a..f4db8db 100644
--- a/crates/examples_common_3d/src/lib.rs
+++ b/crates/examples_common_3d/src/lib.rs
@@ -44,6 +44,16 @@ impl Plugin for ExampleCommonPlugin {
         if !app.is_plugin_added::<PhysicsDebugPlugin>() {
             app.add_plugins(PhysicsDebugPlugin);
         }
+
+        app.add_systems(
+            Update,
+            (
+                (|mut r: ResMut<PhysicsDebugRenderConfig>| {
+                    r.enable_colliders = !r.enable_colliders
+                })
+                    .run_if(input_just_pressed(KeyCode::KeyC)),
+            ),
+        );
     }
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant