//! Demonstrates how to use the [`MeshRayCast`] system parameter to chain multiple ray casts //! and bounce off of surfaces. use std::f32::consts::{FRAC_PI_2, PI}; use bevy::{ color::palettes::css, core_pipeline::{bloom::Bloom, tonemapping::Tonemapping}, math::vec3, picking::backend::ray::RayMap, prelude::*, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, bouncing_raycast) .insert_resource(ClearColor(Color::BLACK)) .run(); } const MAX_BOUNCES: usize = 64; const LASER_SPEED: f32 = 0.03; fn bouncing_raycast( mut ray_cast: MeshRayCast, mut gizmos: Gizmos, time: Res