Module bevy_picking_core::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 PointerHitss 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
PointerLocationcomponents, checkingPickableentities for hits, and producingPointerHitsevents. In plain English, a backend is provided the location of pointers, and is asked to provide a list of entities under those pointers. -
The
PointerHitsevents 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 do not need to consider the
Pickablecomponent, though they may use it for optimization purposes. For example, a backend that traverses a spatial hierarchy may want to early exit if it intersects an entity that blocks lower entities from being picked.
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.