//! This example demonstrates how to use the [`bevy_mod_raycast::deferred`] API. Unlike the //! [`Raycast`] system param, this API is declarative, and does not return a result immediately. //! Instead, behavior is defined using components, and raycasting is done once per frame. use bevy::prelude::*; use bevy_mod_raycast::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(DeferredRaycastingPlugin::::default()) // Overrides default settings and enables the debug cursor .insert_resource(RaycastPluginState::::default().with_debug_cursor()) .add_systems(Startup, setup) .add_systems(Update, move_ray) .run(); } const RAY_DIST: Vec3 = Vec3::new(0.0, 0.0, -7.0); #[derive(Reflect)] struct MyRaycastSet; // Groups raycast sources with meshes, can use `()` instead. #[derive(Component)] struct MovingRaycaster; fn move_ray(time: Res