//! This example demonstrates Bevy's immediate mode drawing API intended for visual debugging. use std::f32::consts::{FRAC_PI_2, PI, TAU}; use bevy::{color::palettes::css::*, math::Isometry2d, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) .init_gizmo_group::() .add_systems(Startup, setup) .add_systems(Update, (draw_example_collection, update_config)) .run(); } // We can create our own gizmo config group! #[derive(Default, Reflect, GizmoConfigGroup)] struct MyRoundGizmos {} fn setup(mut commands: Commands) { commands.spawn(Camera2d); // text commands.spawn( TextBundle::from_section( "Hold 'Left' or 'Right' to change the line width of straight gizmos\n\ Hold 'Up' or 'Down' to change the line width of round gizmos\n\ Press '1' / '2' to toggle the visibility of straight / round gizmos\n\ Press 'U' / 'I' to cycle through line styles\n\ Press 'J' / 'K' to cycle through line joins", TextStyle::default(), ) .with_style(Style { position_type: PositionType::Absolute, top: Val::Px(12.), left: Val::Px(12.), ..default() }), ); } fn draw_example_collection( mut gizmos: Gizmos, mut my_gizmos: Gizmos, time: Res