-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
2580 Split examples PR feedback #15181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely! The example is really really good now, great work :) Left two nits and a correction
examples/camera/camera_orbit.rs
Outdated
} | ||
|
||
#[derive(Debug, Default, Resource)] | ||
struct MouseButtonsPressed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the example would be a bit slimmer without this resource? I get that actions should be separated from keycodes, but we read them in the same system as we do the movement right now anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be me wildly misunderstanding the problem, but: I think only one event gets sent per button pressed (and one on button release). So, the problem becomes how to detect if the user is holding the button, hence the resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be input.just_pressed
. input.pressed
is true
when it was pressed in the first frame and stays true when held the next frames.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: Ah, I see your problem! You're using EventReader<MouseButtonInput>
. Use Res<ButtonInput<MouseButton>>
instead, that already handles this stuff for you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dammit lol I knew something weird was going on!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has now become a really good showcase of different features. Fantastic work!
Objective
Applies feedback from previous PR #15135 'cause it got caught up in the merge train 🚂
I couldn't resist including roll, both for completeness and due to playing too many games that implemented it as a child.
cc: @janhohenheim