Using the Raycast
system param, you don't even need to add a plugin, you can directly raycast into the ECS:
use bevy_mod_raycast::prelude::*;
fn my_raycast_system(mut raycast: Raycast) {
let ray = Ray3d::new(Vec3::ZERO, Vec3::X);
let hits = raycast.cast_ray(ray, &RaycastSettings::default());
}
- 👉 Read the docs!
- Play with the examples.