Crates.io | bevy_picking_state_machine |
lib.rs | bevy_picking_state_machine |
version | 0.1.2 |
created_at | 2025-04-24 21:22:49.413895+00 |
updated_at | 2025-04-25 06:49:44.20282+00 |
description | A global state machine for working with `bevy_picking`. |
homepage | |
repository | https://github.com/mintlu8/bevy_picking_state_machine |
max_upload_size | |
id | 1648118 |
size | 160,279 |
An opinionated global state machine for bevy_picking
. This serves as a drop in replacement
of PickingInteraction
, ButtonInput<MouseButton>
and Window::pointer
that can also handle events like observers. Unlike PickingInteraction
this crate handles global state like dragging correctly.
One action at a time
Only one entity can be "active", i.e. hovered or pressed.
Each entity can only receive one event (like HoverEnter
) in a frame.
There will be no multi-cursor support due to this assumption.
Single button only
The state only tracks one button. Pressing multiple buttons is treated as canceling the current click or drag. This state persists until all buttons are released.
Clean interactions
If any recognized button is already pressed, no new entities can be registered as hovered or pressed.
Add PickingStateMachinePlugin
, do your normal bevy_picking
setup, then use Res<PickingStateMachine>
in your system over PickingInteraction
, that's it!
bevy | bevy_picking_state_machine |
---|---|
0.16 | 0.1-latest |
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.