Add feature to enable debug collider viz.

This commit is contained in:
Joe Ardent 2022-02-28 15:14:38 -08:00
parent 181110c309
commit 281d8b8050
2 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,8 @@ noise = { git = "https://github.com/Razaekel/noise-rs" }
hexasphere = "7" hexasphere = "7"
wgpu = "0.12" wgpu = "0.12"
[features]
debug_render = []
[dependencies.bevy] [dependencies.bevy]
version = "0.6" version = "0.6"

View File

@ -123,6 +123,7 @@ fn setup_bike_collider(bike: Entity, xform: &Transform, commands: &mut Commands)
pub struct CyberCollidersPlugin; pub struct CyberCollidersPlugin;
impl Plugin for CyberCollidersPlugin { impl Plugin for CyberCollidersPlugin {
#[cfg(feature = "debug_render")]
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugin(RapierRenderPlugin) app.add_plugin(RapierRenderPlugin)
.add_startup_system_to_stage( .add_startup_system_to_stage(
@ -130,4 +131,12 @@ impl Plugin for CyberCollidersPlugin {
setup_colliders.label("colliders"), 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"),
);
}
} }