//! 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, drive_gizmos_animation, ), ) .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(( Text::new( "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\n\ Press 'L' to cycle through gizmos animations (only for dotted/dashed round gizmos)\n\ Press 'Spacebar' to toggle pause", ), Node { position_type: PositionType::Absolute, top: px(12), left: px(12), ..default() }, )); } fn draw_example_collection( mut gizmos: Gizmos, mut my_gizmos: Gizmos, time: Res