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

How to check if SelectablePickMesh is selected? #10

Closed
guimcaballero opened this issue Sep 4, 2020 · 4 comments
Closed

How to check if SelectablePickMesh is selected? #10

guimcaballero opened this issue Sep 4, 2020 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@guimcaballero
Copy link
Contributor

I was playing around with this crate (pretty cool btw!). I'm trying to make the wasd keys move the current selected entity. My approach has been to make a system with mut query: Query<&mut SelectablePickMesh>, and then iterate over the query and check for selected, but it turns out it's a private field and it can't be accessed.

Is there another way of doing what I'm trying to do? Or should selected be marked as public?

@aevyrie
Copy link
Owner

aevyrie commented Sep 4, 2020

Good call, yeah, I didn't put much thought into exposing the pick information.

My approach has been to make a system with mut query: Query<&mut SelectablePickMesh>, and then iterate over the query and check for selected, but it turns out it's a private field and it can't be accessed.

That sounds like the right approach to me! I'll add a public getter function.

@aevyrie
Copy link
Owner

aevyrie commented Sep 4, 2020

@guimcaballero Let me know if this change works for you.

Edit: I'd love to see what you made when you get it working!

@aevyrie aevyrie linked a pull request Sep 4, 2020 that will close this issue
@aevyrie aevyrie added bug Something isn't working enhancement New feature or request labels Sep 4, 2020
@aevyrie aevyrie self-assigned this Sep 4, 2020
@guimcaballero
Copy link
Contributor Author

Yup! Works great, thanks for the fast change!

Here's what I'm working on:

bavy

It's an early prototype for an RTS style game, but it's more experimentation than anything else. You can move the camera if nothing is selected, you can move an entity if it's selected, and that's basically it haha.

@aevyrie
Copy link
Owner

aevyrie commented Sep 4, 2020

@guimcaballero That is super cool! You should post that in the bevy discord showcase channel!

@aevyrie aevyrie closed this as completed Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants