{"id":15017964,"url":"https://github.com/aevyrie/bevy_mod_picking","last_synced_at":"2025-03-05T03:05:08.347Z","repository":{"id":38240497,"uuid":"291606585","full_name":"aevyrie/bevy_mod_picking","owner":"aevyrie","description":"Picking and pointer events for Bevy","archived":false,"fork":false,"pushed_at":"2024-11-05T08:12:14.000Z","size":52155,"stargazers_count":831,"open_issues_count":34,"forks_count":181,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-02-26T02:09:08.824Z","etag":null,"topics":["bevy","cursor","pick-intersections","raycasting"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/bevy_mod_picking","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aevyrie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"aevyrie"}},"created_at":"2020-08-31T03:39:05.000Z","updated_at":"2025-02-24T01:21:43.000Z","dependencies_parsed_at":"2023-02-17T03:45:32.792Z","dependency_job_id":"2c871a16-81f1-47e3-adb2-b0298e116651","html_url":"https://github.com/aevyrie/bevy_mod_picking","commit_stats":{"total_commits":673,"total_committers":55,"mean_commits":"12.236363636363636","dds":"0.15453194650817237","last_synced_commit":"74f0c3c0fbc8048632ba46fd8f14e26aaea9c76c"},"previous_names":[],"tags_count":130,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aevyrie%2Fbevy_mod_picking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aevyrie%2Fbevy_mod_picking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aevyrie%2Fbevy_mod_picking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aevyrie%2Fbevy_mod_picking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aevyrie","download_url":"https://codeload.github.com/aevyrie/bevy_mod_picking/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241955046,"owners_count":20048405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bevy","cursor","pick-intersections","raycasting"],"created_at":"2024-09-24T19:51:15.640Z","updated_at":"2025-03-05T03:05:08.341Z","avatar_url":"https://github.com/aevyrie.png","language":"Rust","funding_links":["https://github.com/sponsors/aevyrie"],"categories":["Plugins and Crates","Rust","Input"],"sub_categories":["3D"],"readme":"\u003e [!IMPORTANT]\n\u003e This crate is archived after being upstreamed in bevy 0.15.\n\u003e https://bevyengine.org/news/bevy-0-15/#entity-picking-selection\n\n\u003cdiv align=\"center\"\u003e\n\n# Picking and Pointer Events for Bevy\n\n[![crates.io](https://img.shields.io/crates/v/bevy_mod_picking)](https://crates.io/crates/bevy_mod_picking)\n[![docs.rs](https://docs.rs/bevy_mod_picking/badge.svg)](https://docs.rs/bevy_mod_picking)\n[![CI](https://github.com/aevyrie/bevy_mod_picking/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/aevyrie/bevy_mod_picking/actions?query=workflow%3A%22CI%22+branch%3Amain)\n\n![demo](https://user-images.githubusercontent.com/2632925/235874600-de0c7720-6775-42e1-8650-41ee8ac68d1b.gif)\n\nA flexible set of plugins that add picking functionality to your [`bevy`](https://github.com/bevyengine/bevy) app. Want to drag a UI\nentity and drop it onto a 3D mesh entity? This plugin allows you to add event listeners to **any**\nentity, and works with mouse, touch, or even gamepads.\n\n\u003c/div\u003e\n\n# Highlights\n\n- ***Lightweight***: only compile what you need.\n- ***Expressive***: event listener components `On::\u003cPointer\u003cClick\u003e\u003e::run(my_system)`.\n- ***Input Agnostic***: control pointers with mouse, pen, touch, or custom bevy systems.\n- ***Modular Backends***: mix and match backends like `rapier`, `egui`, `bevy_ui`, or write your own.\n\n## Lightweight\n\nOnly compile what you use. All non-critical plugins can be disabled, including highlighting,\nselection, and any backends not in use. The crate uses no external dependencies unless you need it\nfor a backend, e.g. `egui` or `rapier`.\n\n## Expressive\n\nThe `On::\u003cPointer\u003cE\u003e\u003e` event listener component makes it easy to react to pointer interactions like\n`Click`, `Over`, and `Drag`. Events bubble up the entity hierarchy starting from their target\nlooking for event listeners, and running any listener's callbacks. These callbacks are normal bevy\nsystems, though a number of helpers are provided to reduce boilerplate:\n\n```rs\ncommands.spawn((\n    PbrBundle { /* ... */ },\n    // These callbacks are run when this entity or its children are interacted with.\n    On::\u003cPointer\u003cMove\u003e\u003e::run(change_hue_with_vertical_move),\n    // Rotate an entity when dragged:\n    On::\u003cPointer\u003cDrag\u003e\u003e::target_component_mut::\u003cTransform\u003e(|drag, transform| {\n        transform.rotate_local_y(drag.delta.x / 50.0)\n    }),\n    // Despawn an entity when clicked:\n    On::\u003cPointer\u003cClick\u003e\u003e::target_commands_mut(|_click, target_commands| {\n        target_commands.despawn();\n    }),\n    // Send an event when the pointer is pressed over this entity:\n    On::\u003cPointer\u003cDown\u003e\u003e::send_event::\u003cDoSomethingComplex\u003e(),\n));\n```\n\nIf you don't need event bubbling or callbacks, you can respond to pointer events like you would any\nother bevy event, using `EventReader\u003cPointer\u003cClick\u003e\u003e`, `EventReader\u003cPointer\u003cMove\u003e\u003e`, etc.\n\n## Input Agnostic\n\nPointers can be controlled with anything, whether it's the included mouse or touch inputs, or a\ncustom gamepad input system you write yourself.\n\n## Modular Backends\n\nPicking backends run hit tests to determine if a pointer is over any entities. This plugin provides\nan [extremely simple API to write your own backend](crates/bevy_picking_core/src/backend.rs) in\nabout 100 lines of code; it also includes half a dozen backends out of the box. These include\n`rapier`, `egui`, and `bevy_ui`, among others. Multiple backends can be used at the same time! \n\nYou can have a simple rect hit test backend for your UI, a GPU picking shader for your 3D scene, and\nthis plugin will handle sorting hits and generating events.\n\n## Robust\n\nIn addition to these features, this plugin also correctly handles multitouch, multiple windows,\nrender layers, viewports, and camera order.\n\n# Getting Started\n\nMaking objects pickable is pretty straightforward. In the most minimal cases, it's as simple as adding the plugin to your app:\n\n```rs\n.add_plugins(DefaultPickingPlugins)\n```\n\nand adding the `PickableBundle` to entities that can be picked with the backends you are using:\n\n```rs\ncommands.spawn((\n    PbrBundle::default(),           // The `bevy_picking_raycast` backend works with meshes\n    PickableBundle::default(),      // Makes the entity pickable\n));\n```\n\nYou can find a list of built-in backends [here](https://docs.rs/bevy_mod_picking/latest/bevy_mod_picking/backends/index.html)\n\n## Next Steps\n\nTo learn more, [read the docs](https://docs.rs/bevy_mod_picking/latest/bevy_mod_picking/) and take a look at the examples in the `/examples` directory. Understanding [bevy_eventlistener](https://github.com/aevyrie/bevy_eventlistener) will also help. Once you are comfortable with that, this crate's `event_listener` example is a great place to start.\n\n# Bevy Version Support\n\n| bevy | bevy_mod_picking |\n| ---- | ---------------- |\n| 0.14 | 0.20             |\n| 0.13 | 0.18, 0.19       |\n| 0.12 | 0.17             |\n| 0.11 | 0.15, 0.16       |\n| 0.10 | 0.12, 0.13, 0.14 |\n| 0.9  | 0.10, 0.11       |\n| 0.8  | 0.8, 0.9         |\n| 0.7  | 0.6, 0.7         |\n| 0.6  | 0.5              |\n| 0.5  | 0.4              |\n| 0.4  | 0.3              |\n| 0.3  | 0.2              |\n| 0.2  | 0.1              |\n\n# License\n\nAll code in this repository is dual-licensed under either:\n\n- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)\n- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)\n\nat your option. This means you can select the license you prefer.\n\n## Your contributions\nUnless 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.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faevyrie%2Fbevy_mod_picking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faevyrie%2Fbevy_mod_picking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faevyrie%2Fbevy_mod_picking/lists"}