Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointerDrag component #288

Open
musjj opened this issue Dec 9, 2023 · 1 comment
Open

PointerDrag component #288

musjj opened this issue Dec 9, 2023 · 1 comment

Comments

@musjj
Copy link

musjj commented Dec 9, 2023

A PointerDrag component would be convenient for checking if a certain pointer is dragging something when you're dealing with complex logic.

Maybe it can look something like this:

#[derive(Component, Deref)]
struct PointerDrag(Option<Entity>);

It will contain Some(Entity) when the pointer is currently dragging an entity.

@aevyrie
Copy link
Owner

aevyrie commented Mar 3, 2024

This already exists in the form of events and event listeners. You could create your own special purpose component for this purpose if you want some other behavior.

https://docs.rs/bevy_mod_picking/latest/bevy_mod_picking/events/struct.Drag.html
https://github.com/aevyrie/bevy_mod_picking/blob/main/examples/drag_and_drop.rs

I'm not sure if we want to add components for every type of event. This would also need to be a Vec, as a pointer can be dragging multiple entities at a time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants