-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Pass position to HitData for window pointer hits
#21802
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Member
|
@laundmo, can I get your review here? |
alice-i-cecile
approved these changes
Nov 10, 2025
Member
|
Oh wow, that's shockingly easy. Thanks! |
laundmo
approved these changes
Nov 10, 2025
Contributor
|
I had guessed it would be easy, it seemed like an oversight to me. That's why i made it a bug report and not a feature request. I'm glad it could be someones first contribution to bevy! |
DaAlbrecht
approved these changes
Nov 11, 2025
mockersf
approved these changes
Nov 13, 2025
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Nov 15, 2025
# Objective - Mouse position from `On<Pointer<Move>>` is `None` when accessing from an observer added to a window. - Fixes bevyengine#21778 ## Solution - Pass position to `HitData` in `bevy_picking::window::update_window_hits` - Update doc comment ## Testing The following now works: ```rust use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } fn setup(mut commands: Commands) { commands.spawn(Camera2d); commands .spawn(Window::default()) .observe(|trigger: On<Pointer<Move>>| { assert!( trigger.hit.position.is_some(), "Position should not be None" ); }); } ```
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Nov 16, 2025
# Objective - Mouse position from `On<Pointer<Move>>` is `None` when accessing from an observer added to a window. - Fixes bevyengine#21778 ## Solution - Pass position to `HitData` in `bevy_picking::window::update_window_hits` - Update doc comment ## Testing The following now works: ```rust use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } fn setup(mut commands: Commands) { commands.spawn(Camera2d); commands .spawn(Window::default()) .observe(|trigger: On<Pointer<Move>>| { assert!( trigger.hit.position.is_some(), "Position should not be None" ); }); } ```
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Nov 16, 2025
# Objective - Mouse position from `On<Pointer<Move>>` is `None` when accessing from an observer added to a window. - Fixes bevyengine#21778 ## Solution - Pass position to `HitData` in `bevy_picking::window::update_window_hits` - Update doc comment ## Testing The following now works: ```rust use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } fn setup(mut commands: Commands) { commands.spawn(Camera2d); commands .spawn(Window::default()) .observe(|trigger: On<Pointer<Move>>| { assert!( trigger.hit.position.is_some(), "Position should not be None" ); }); } ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Picking
Pointing at and selecting objects of all sorts
C-Bug
An unexpected or incorrect behavior
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
On<Pointer<Move>>isNonewhen accessing from an observer added to a window.Solution
HitDatainbevy_picking::window::update_window_hitsTesting
The following now works: