#gamedev #graphics #bevy #3d #raycast


Ray Casting for the Bevy Engine

4 releases

0.2.2 Apr 12, 2021
0.2.1 Apr 8, 2021
0.2.0 Apr 8, 2021
0.1.0 Jan 22, 2021

#196 in Game dev

Download history 1/week @ 2021-02-27 3/week @ 2021-03-06 6/week @ 2021-03-20 1/week @ 2021-03-27 83/week @ 2021-04-03 150/week @ 2021-04-10 86/week @ 2021-04-17 107/week @ 2021-04-24 85/week @ 2021-05-01 48/week @ 2021-05-08 46/week @ 2021-05-15 51/week @ 2021-05-22 77/week @ 2021-05-29 76/week @ 2021-06-05

196 downloads per month
Used in 2 crates (via bevy_mod_picking)

MIT license

881 lines

Ray Casting for Bevy

CI crates.io docs.rs Bevy tracking

A Bevy plugin for 3D ray casting against meshes. Used to build bevy_mod_picking. Contributions welcome!


This plugin makes it simple to create ray casting sources, such as a transform (first person, third person shooter), or screenspace coordinates (mouse picking). Rays are shot from these sources every frame using a bevy system, and the intersections are stored in the ray casting source's component.

  • Only meshes that you mark with a component will be checked for intersections.
  • You can define which ray casting source(s) should interact with which mesh(es) by marking grouped sources and targets with the same type.
  • This plugin also provides some functionality to compute the intersection of rays with primitive shapes.
  • Rudimentary acceleration is provided with opt-in bounding spheres.

Bevy Version Support

I intend to track the main branch of Bevy. PRs supporting this are welcome!

bevy bevy_mod_raycst
0.5 0.2
0.4 0.1


Mouse picking using a ray cast built using screen space coordinates:

cargo run --example mouse_picking --features ex

Ray casting from a camera using ray casts from the camera entity's GlobalTransform:

cargo run --example minimal --features ex


~437K SLoC