bevy_picking_state_machine

Crates.iobevy_picking_state_machine
lib.rsbevy_picking_state_machine
version0.1.2
created_at2025-04-24 21:22:49.413895+00
updated_at2025-04-25 06:49:44.20282+00
descriptionA global state machine for working with `bevy_picking`.
homepage
repositoryhttps://github.com/mintlu8/bevy_picking_state_machine
max_upload_size
id1648118
size160,279
Mincong Lu (mintlu8)

documentation

README

bevy_picking_state_machine

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.

Rules

  • 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.

Getting Started

Add PickingStateMachinePlugin, do your normal bevy_picking setup, then use Res<PickingStateMachine> in your system over PickingInteraction, that's it!

Versions

bevy bevy_picking_state_machine
0.16 0.1-latest

License

Licensed under either of

at your option.

Contribution

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.

Commit count: 9

cargo fmt