Module bevy_mod_raycast::deferred
source · Expand description
§Deferred Raycasting API
See the minimal_deferred
example for reference.
This API requires you add a RaycastSource
to the entity that will be generating rays, and a
RaycastMesh
to all meshes that you want to raycast against. The RaycastSource
has some
built in modes for common use cases. You can set this entity to cast based on where it is
pointing, using RaycastMethod::Transform
, or you can use RaycastMethod::Screenspace
along with a screenspace coordinate if the entity is a camera and you want to shoot out of a
reticle, or you can use RaycastMethod::Cursor
if you want to automatically use the cursor to
build rays.
These components are both generic, and raycasts will only happen between entities with the same
generic parameter. For example, RaycastSource<Foo>
can cast rays against meshes with
RaycastMesh<Foo>
, but not against meshes that instead only have a RaycastMesh<Bar>
component.
Modules§
Structs§
- Marks an entity as pickable, with type T.
- Global plugin state used to enable or disable all ray casting for a given type T.
- The
RaycastSource
component is used to generate rays with the specifiedcast_method
. Aray
is generated when the RaycastSource is initialized, either by waiting for update_raycast system to process the ray, or by using awith_ray
function.`
Enums§
- Specifies the method used to generate rays.
Functions§
- Iterates through all entities with the RaycastMesh component, checking for intersections. If these entities have bounding volumes, these will be checked first, greatly accelerating the process.