From 281d8b8050e7ee015f129cae75832a14ac698330 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Mon, 28 Feb 2022 15:14:38 -0800 Subject: [PATCH] Add feature to enable debug collider viz. --- Cargo.toml | 2 ++ src/colliders.rs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index ba220cc..59050de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,8 @@ noise = { git = "https://github.com/Razaekel/noise-rs" } hexasphere = "7" wgpu = "0.12" +[features] +debug_render = [] [dependencies.bevy] version = "0.6" diff --git a/src/colliders.rs b/src/colliders.rs index 263d460..dae6aad 100644 --- a/src/colliders.rs +++ b/src/colliders.rs @@ -123,6 +123,7 @@ fn setup_bike_collider(bike: Entity, xform: &Transform, commands: &mut Commands) pub struct CyberCollidersPlugin; impl Plugin for CyberCollidersPlugin { + #[cfg(feature = "debug_render")] fn build(&self, app: &mut App) { app.add_plugin(RapierRenderPlugin) .add_startup_system_to_stage( @@ -130,4 +131,12 @@ impl Plugin for CyberCollidersPlugin { setup_colliders.label("colliders"), ); } + + #[cfg(not(feature = "debug_render"))] + fn build(&self, app: &mut App) { + app.add_startup_system_to_stage( + StartupStage::PostStartup, + setup_colliders.label("colliders"), + ); + } }