Module bevy_mod_picking::backend
source · Expand description
This module provides a simple interface for implementing a picking backend.
Because bevy_picking_core is very loosely coupled with its backends, you can mix and match as
many backends as you want. For example, You could use the rapier
backend to raycast against
physics objects, a picking shader backend to pick non-physics meshes, and a custom backend for
your UI. The PointerHits
s produced by these various backends will be combined, sorted, and
used as a homogeneous input for the picking systems that consume these events.
Implementation
-
A picking backend only has one job: reading
PointerLocation
components, checkingPickable
entities for hits, and producingPointerHits
events. In plain English, a backend is provided the location of pointers, and is asked to provide a list of entities under those pointers. -
The
PointerHits
events produced by a backend do not need to be sorted or filtered, all that is needed is an unordered list of entities and theirHitData
. -
Backends should only pick entities with the
Pickable
component.
Modules
- Common imports for implementing a picking backend.
Structs
- Holds data from a successful pointer hit test.
- An event produced by a picking backend after it has run its hit tests, describing the entities under a pointer.
Traits
- Implement this trait for a group of plugins to make them useable as a picking backend.