I'm building a word game and the player is able to select letters by clicking and dragging. However if they drag too fast letters get skipped. Basically the cursor passes entirely over the letter in less than one frame.
I'm triggering the system by listening for a MouseMotion event, but because that only gives you deltas and not the position so I'm reading the cursor position as shown in this example. https://github.com/bevyengine/bevy/blob/latest/examples/2d/2d_viewport_to_world.rs
If there is more than one MouseMotion event per frame, both of those will have the same cursor position read from the world. Which makes sense since the system is executed once per frame.
I was able the log this. The two MouseMotions that happen between frames have the same cursor position, the second Vec2 in the log.
2024-01-25T19:38:16.884567Z INFO Wordtris::cursor: FRAME
2024-01-25T19:38:16.884588Z INFO Wordtris::cursor: MouseMotion { delta: Vec2(0.0, -17.0) } === Vec2(-52.606808, 342.55542)
2024-01-25T19:38:16.884597Z INFO Wordtris::cursor: MouseMotion { delta: Vec2(12.0, -48.0) } === Vec2(-52.606808, 342.55542)
2024-01-25T19:38:16.900753Z INFO Wordtris::cursor: FRAME
2024-01-25T19:38:16.900777Z INFO Wordtris::cursor: MouseMotion { delta: Vec2(34.0, -56.0) } === Vec2(-18.312813, 398.2832)
2024-01-25T19:38:16.917889Z INFO Wordtris::cursor: FRAME
I was thinking that I could use the delta's from the MouseMotion to sort of back calculate the mouse position at each point but there must be a way to pull this data directly.
Thanks.