Leafwing-Studios / leafwing-input-manager

A straightforward stateful input manager for the Bevy game engine.
Apache License 2.0
686 stars 106 forks source link

Fix mouse accumulation #543

Closed alice-i-cecile closed 3 months ago

alice-i-cecile commented 3 months ago

Fixes #538.

After substantial investigation, an upstream fix (that didn't end up being needed) and some serious refactoring, mouse motion and mouse scroll inputs tests are all green.

Basically, rather than summing the inputs in the middle of computing the raw inputs for each action, we're computing it once, in preupdate, and then fetching that value as a resource. This, unsurprisingly, should be upstreamed to bevy_input rather than living in LWIM.

alice-i-cecile commented 3 months ago

There are two paths forward with this PR:

  1. Wait for the upstream fix to be merged, which should make this patch work as is.
  2. Swap to a resource which accumulates mouse motion / mouse wheel scroll and just read that.

The second is probably better, to avoid repeated wasted work.