Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
410b188
Simplify highlighting assets further
aevyrie Jun 1, 2022
25e67a4
WIP commit to capture refactor progress
aevyrie Jun 1, 2022
07b3551
more wip
aevyrie Jun 2, 2022
49e2ea7
wip
aevyrie Jun 5, 2022
b35c652
wip
aevyrie Jun 5, 2022
a147e07
Merge branch 'main' into refactor
aevyrie Jun 7, 2022
c39ea22
Update LICENSE
aevyrie Jun 15, 2022
5cb9ba5
input refactor
aevyrie Jun 19, 2022
d21c10c
functioning cursor hits with raycast backend
aevyrie Jun 21, 2022
c32b1f8
hovering working, selection buggy
aevyrie Jun 23, 2022
13b2f97
system ordering cleanup
aevyrie Jun 23, 2022
cffd543
selection wip
aevyrie Jun 27, 2022
22c4bd0
fixed inputs and hits
aevyrie Jun 29, 2022
403191f
fix click events
aevyrie Jun 29, 2022
9d3a78d
event based picking
aevyrie Jun 29, 2022
b9f5e85
explicitly track interaction state
aevyrie Jun 30, 2022
27cb442
event based interaction rewrite
aevyrie Jul 7, 2022
29a40f9
Get multi window example working
aevyrie Jul 7, 2022
21642eb
cleanup
aevyrie Jul 7, 2022
17a29e9
more cleanup
aevyrie Jul 7, 2022
ca863dd
working bubbling
aevyrie Jul 16, 2022
bf66e0d
command callbacks
aevyrie Jul 17, 2022
f561cb7
impl event forwarding command
aevyrie Jul 19, 2022
98df98c
gltf picking
aevyrie Jul 19, 2022
d0fbe58
drag events
aevyrie Jul 20, 2022
d7116c4
remove unused module
aevyrie Jul 21, 2022
feab707
cleanup
aevyrie Jul 21, 2022
724579f
better backend names
aevyrie Jul 21, 2022
22eb9e8
Split out highlight and selection as crates and make optional
aevyrie Jul 21, 2022
94a8be2
fix up examples
aevyrie Jul 21, 2022
df5ff5c
clippy
aevyrie Jul 21, 2022
ff2968f
update licenses
aevyrie Jul 21, 2022
99301e8
Fix ordering bug
aevyrie Jul 21, 2022
d717a23
Update presentmode
aevyrie Jul 21, 2022
82267f0
improve multi window example
aevyrie Jul 21, 2022
516d4ae
dragover and drop events
aevyrie Jul 24, 2022
ac28408
doc comments
aevyrie Jul 25, 2022
0a46df3
Document evenrything
aevyrie Jul 26, 2022
25be65e
refactor selection to match updated crates
aevyrie Jul 26, 2022
d3441ba
Improve selection docs
aevyrie Jul 26, 2022
b782ef5
doc polish
aevyrie Jul 26, 2022
efb89ba
improve docs
aevyrie Jul 27, 2022
b4ea94f
remove unused vars from query
aevyrie Jul 27, 2022
4d9b4a0
add working rapier deps
aevyrie Jul 27, 2022
a945d99
comment out reference code
aevyrie Jul 27, 2022
ec781d0
rapier backend
aevyrie Jul 28, 2022
e788be4
Cleanup, bugfixing
aevyrie Jul 28, 2022
17445ff
mark shader plugin as unimplemented
aevyrie Jul 28, 2022
860f6ee
Add some example comments
aevyrie Jul 29, 2022
ffd0872
Add more description for pointer ids and bundles
aevyrie Jul 29, 2022
1a198a6
Update crates/backends/bevy_picking_shader/NOTES.md
aevyrie Jul 29, 2022
58ba63e
Apply suggestions from code review
aevyrie Jul 29, 2022
54c4447
Add more documentation
aevyrie Jul 29, 2022
7f7f58f
use git instead of local dep
aevyrie Jul 30, 2022
8fbe921
fix dev deps for examples
aevyrie Jul 30, 2022
b19b8e2
update crate releases
aevyrie Jul 31, 2022
1b26baa
review feedback, pointer bundle docs
aevyrie Jul 31, 2022
6a9df3b
forwarding cont
aevyrie Aug 10, 2022
67752c7
bevy ui picking backend
aevyrie Aug 10, 2022
36f4b59
working bevy ui impl
aevyrie Aug 17, 2022
f4a4191
Add drag and drop
aevyrie Sep 7, 2022
44bf78d
Fix tests and docs
aevyrie Sep 7, 2022
92dcda1
cleanup
aevyrie Sep 7, 2022
85177f1
review feedback
aevyrie Sep 14, 2022
98b60ff
review feedback
aevyrie Sep 15, 2022
3ef4608
Merge branch 'refactor' of https://github.com/aevyrie/bevy_mod_pickin…
aevyrie Sep 15, 2022
c8ec70d
touch fixes
aevyrie Sep 18, 2022
fe31356
fix touch input
aevyrie Sep 23, 2022
0bd6ac0
wip debugging touch raise events
aevyrie Oct 4, 2022
d34038a
more notes
aevyrie Oct 4, 2022
b6005ef
more notes
aevyrie Oct 4, 2022
207d1f2
Merge branch 'refactor' of https://github.com/aevyrie/bevy_mod_pickin…
aevyrie Oct 5, 2022
4ac198a
refactoring
aevyrie Oct 7, 2022
02484a7
fix missing touch click/drop events
aevyrie Oct 17, 2022
bfbb0f7
cleanup
aevyrie Oct 17, 2022
f8aa67d
improve drag and drop example
aevyrie Oct 17, 2022
5d12856
update drag and drop example
aevyrie Oct 22, 2022
639a493
remove errant import
aevyrie Oct 22, 2022
5bff6a8
remove dragover debug spam
aevyrie Oct 22, 2022
277cd3a
fix drag leave bug caused by drag over only using a single entity
aevyrie Oct 22, 2022
298df14
minor fixes
aevyrie Oct 22, 2022
59904e1
fix multiselect
aevyrie Oct 27, 2022
c281e6d
Add debug text
aevyrie Oct 27, 2022
8796959
license and font
aevyrie Oct 28, 2022
4b84ea3
bevy 0.9
aevyrie Nov 14, 2022
1223a24
Impl sprite picking, add pointer debug reticle, tidy examples
aevyrie Dec 15, 2022
dc31b49
CI fixes
aevyrie Dec 15, 2022
eb147a2
Merge remote-tracking branch 'origin/main' into refactor
aevyrie Dec 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"

[toolchain.nightly]
rustflags = ["-Zshare-generics=n"]
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ Cargo.lock
.idea
.cargo/credentials.toml
.cargo/config_fast_compile
**/trace-*.json
**/trace-*.json

# Added by cargo
#
# already existing elements were commented out

#/target
/Cargo.lock
53 changes: 40 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,56 @@ name = "bevy_mod_picking"
version = "0.11.0"
authors = ["Aevyrie <[email protected]>"]
edition = "2021"
license = "MIT"
description = "A 3D mouse picking and raycasting plugin for Bevy."
license = "MIT OR Apache-2.0"
description = "A modular picking plugin for Bevy."
repository = "https://github.com/aevyrie/bevy_mod_picking/"
keywords = ["gamedev", "picking", "bevy", "raycast"]
keywords = ["gamedev", "picking", "bevy", "raycast", "input"]
categories = ["game-engines", "rendering"]
resolver = "2"

[dependencies]
bevy = { version = "0.9", default-features = false, features = ["render"] }
[workspace]
members = ["crates/*", "backends/*"]

bevy_mod_raycast = "0.7"
[dependencies]
bevy = { version = "0.9", default-features = false, features = [
"bevy_render",
"bevy_ui",
] }
# Local
bevy_picking_core = { path = "crates/bevy_picking_core" }
bevy_picking_input = { path = "crates/bevy_picking_input" }
bevy_picking_selection = { path = "crates/bevy_picking_selection" }
bevy_picking_highlight = { path = "crates/bevy_picking_highlight" }
bevy_picking_raycast = { optional = true, path = "backends/bevy_picking_raycast" }
bevy_picking_ui = { optional = true, path = "backends/bevy_picking_ui" }
bevy_picking_rapier = { optional = true, path = "backends/bevy_picking_rapier" }
bevy_picking_shader = { optional = true, path = "backends/bevy_picking_shader" }
bevy_picking_sprite = { optional = true, path = "backends/bevy_picking_sprite" }

[dev-dependencies]
bevy = { version = "0.9", default-features = false, features = [
"bevy_pbr",
"bevy_winit",
"bevy_ui",
"bevy_core_pipeline",
"bevy_text",
"x11",
"bevy_gltf",
"bevy_scene",
"png",
] }
bevy_framepace = "0.9.1"
bevy_rapier3d = { git = "https://github.com/devil-ira/bevy_rapier", branch = "bevy-0.9" }
bevy_mod_picking = { path = "", features = ["all"] }

[features]
default = ["2d", "debug"]
2d = ["bevy_mod_raycast/2d"]
debug = ["bevy_mod_raycast/debug"]
default = ["backend_raycast", "backend_bevy_ui", "debug"]
all = [
"backend_raycast",
"backend_bevy_ui",
"backend_rapier",
"backend_shader",
"backend_sprite",
]
debug = ["bevy/bevy_text"]
backend_raycast = ["bevy_picking_raycast"]
backend_rapier = ["bevy_picking_rapier"]
backend_shader = ["bevy_picking_shader"]
backend_sprite = ["bevy_picking_sprite"]
backend_bevy_ui = ["bevy_picking_ui"]
176 changes: 176 additions & 0 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
4 changes: 1 addition & 3 deletions LICENSE → LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
MIT License

Copyright (c) 2020 Aevyrie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand All @@ -18,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![CI](https://github.com/aevyrie/bevy_mod_picking/workflows/CI/badge.svg?branch=master)](https://github.com/aevyrie/bevy_mod_picking/actions?query=workflow%3A%22CI%22+branch%3Amaster)
[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-main-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)

![picking_demo](https://user-images.githubusercontent.com/2632925/201516335-9ee66106-b2d8-4eb5-bc32-18da072999a2.gif)
![picking_demo](https://user-images.githubusercontent.com/2632925/114128723-d8de1b00-98b1-11eb-9b25-812fcf6664e2.gif)

A [Bevy](https://github.com/bevyengine/bevy) plugin for picking, making it easy to interact
with meshes in Bevy. Built with [`bevy_mod_raycast`](https://github.com/aevyrie/bevy_mod_raycast).
Expand All @@ -19,34 +19,45 @@ with meshes in Bevy. Built with [`bevy_mod_raycast`](https://github.com/aevyrie/
* Mouseover and mouseclick events
* Configurable highlighting
* Selection state management
* 3D debug cursor
* 3D debug pointer
* Touch support
* Common keybindings (Ctrl+A, Ctrl+Click multi-select)

# Quickstart

It only takes a few lines to get mouse picking working in your Bevy application using this plugin.

1. Add the plugin to your app:
1. Add the crate to your dependencies in `Cargo.toml`:
```toml
bevy_mod_picking = "0.6"
```

2. Import the plugin:
```rs
.add_plugins(DefaultPickingPlugins);
use bevy_mod_picking::*;
```

2. Mark your camera as the picking source with the `PickingCameraBundle` component:
3. Add the plugin to your app:
```rs
.insert_bundle(PickingCameraBundle::default());
.add_plugin(DefaultPickingPlugin);
```

3. Add the `PickableBundle` component to any meshes you want to make pickable:
4. Mark your camera as the picking source with the `PickingSourceBundle` component:
```rs
.insert_bundle(PickableBundle::default())
.insert((PickingSourceBundle::default());
```


4. Add the `PickableBundle` component to any meshes you want to make pickable:
```rs
.insert((PickableBundle::default())
```

That's all there is to it! Read [the docs](https://docs.rs/bevy_mod_picking) and look at the provided examples to learn more.

# Demo

To run a minimal demo, clone this repository and run:
To run a minimal demo of picking features, clone this repository and run:

```console
cargo run --example minimal
Expand All @@ -56,10 +67,9 @@ cargo run --example minimal

I intend to track the `main` branch of Bevy. PRs supporting this are welcome!


| bevy | bevy_mod_picking |
| ---- | ---------------- |
| 0.9 | 0.10, 0.11 |
| 0.8 | 0.8, 0.9 |
| 0.7 | 0.6, 0.7 |
| 0.6 | 0.5 |
| 0.5 | 0.4 |
Expand Down
Binary file added assets/fonts/FiraMono-Medium.ttf
Binary file not shown.
Binary file removed assets/fonts/FiraSans-Bold.ttf
Binary file not shown.
Binary file added assets/images/bavy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/models/FlightHelmet/FlightHelmet.bin
Binary file not shown.
Loading