- Fixed system order ambiguity between bevy_ui and update_action_state systems
- The input values of axis inputs in a
Chord
are now prioritized over buttons - Fixed unassigned
InputMaps
s not receiving input from all connected gamepads
- Fixed invalid example code in README
- Added example for setting default controls
- Added
DeadZoneShape
forDualAxis
which allows for different deadzones shapes: cross, rectangle, and ellipse. - Added sensitivity for
SingleAxis
andDualAxis
, allowing you to scale mouse, keypad and gamepad inputs differently for each action.
bevy
dependency has been bumped from 0.10 to 0.11.ActionLike
now requires Bevy'sTypePath
trait. Your actions will now need to deriveReflect
orTypePath
. See bevy#7184QwertyScanCode
has had its variants renamed to match bevy'sKeyCode
variants. See bevy#8792
- Changed
entity
field ofActionStateDriver
totargets: ActionStateDriverTarget
with variants for 0, 1, or multiple targets, to allow for one driver to update multiple entities if needed. - Added builder-style functions to
SingleAxis
,DualAxis
, andVirtualDPad
that invert their output values, allowing, for example, binding inverted camera controls.
- Added example for driving cursor position action from another entity.
- Makes
run_if_enabled
public.
- Changed
Rotation
to be stored in millionths of a degree instead of tenths of a degree in order to reduce rounding errors.
- Added
VirtualAxis::horizontal_dpad()
andVirtualAxis::vertical_dpad()
. - Do not read mouse input if any
bevy_ui
element have activeInteraction
.
- Fixed
DualAxis
inputs so deadzones apply across both axes, and filter out-of-range values correctly.
- Added common run conditions for actions that mirrors input conditions in Bevy.
- Added
ActionState::consume_all()
to consume all actions. bevy_egui
dependency has been bumped from 0.19 to 0.20.bevy
dependency has been bumped from 0.9 to 0.10.
- Added scan code support, which enables you to define keybindings depending on the key position rather than the key output.
This is useful to make the keybindings layout-independent and is commonly used for the WASD movement controls.
- Use
ScanCode
to define the raw scan code values. - Use
QwertyScanCode
to define the scan code by the name of the key on the US QWERTY keyboard layout.
- Use
- The
Actionlike::N_VARIANTS
constant has been changed to a function. - Added the
DynAction
type and various companions to enable more advanced use cases.
bevy_egui
dependency has been bumped from 0.18 to 0.19.
- Added custom implementation of the
Serialize
andDeserialize
traits forInputMap
to make the format more human readable. - Added
TypeUuid
forInputMap
to be able use it as asset without wrapper ActionState
and its fields now implementReflect
. The type is automatically registered when theInputManagerPlugin
is added.- Added
PressScheduler
, used to defer action presses until the start of the next frame to ease scheduling.
egui
feature now works correctly and more robustly if anEguiPlugin
is not actually enabled.
- Added
VirtualAxis
struct that can be supplied to anInputMap
to trigger on two direction-representing inputs. 1-dimensional equivalent toVirtualDPad
.
- Added
egui
feature to not take specific input sources into account when egui is using them. For example, when the user clicks on a widget, the actions associated with the mouse will not be taken into account. InputStreams
no longer stores anOption
to an input stream type: all fields other thanassociated_gamepad
are now required. This was not useful in practice and added significant complexity.
- no longer print "real clash" due to a missed debugging statement
- Added the
Modifier
enum, to ergonomically capture the notion of "either control/alt/shift/windows key".- The corresponding
InputKind::Modifier
variant was added to match. - You can conveniently construct these using the
InputKind::modified
orInputMap::insert_modified
methods.
- The corresponding
- Implemented
Eq
forTiming
andInputMap
. - Held
ActionState
inputs will now be released when anInputMap
is removed. - Improve
ToggleActions
.- Make
_phantom
field public and rename intophantom
. - Add
ToggleActions::ENABLED
andToggleActions::DISABLED
.
- Make
- Added
SingleAxis::negative_only
andSingleAxis::positive_only
for triggering separate actions for each direction of an axis. ActionData::action_data
now returns a reference, rather than a clone, for consistency and explicitness- added
with_deadzone
methods to configure the deadzones for bothSingleAxis
andDualAxis
inputs
- Fixed gamepad axes not filtering out inputs outside of the axis deadzone.
- Fixed
DualAxis::right_stick()
returning the y axis for the left stick.
- removed a missed
println
statement spamming "real conflict" that had been missed
- Added gamepad axis support.
- Use the new
SingleAxis
andDualAxis
types / variants.
- Use the new
- Added mousewheel and mouse motion support.
- Use the new
SingleAxis
andDualAxis
types / variants when you care about the continuous values. - Use the new
MouseWheelDirection
enum as anInputKind
.
- Use the new
- Added
SingleAxis
andDualAxis
structs that can be supplied to anInputMap
to trigger on axis inputs. - Added
VirtualDPad
struct that can be supplied to anInputMap
to trigger on four direction-representing inputs. - Added
ActionState::action_axis_pair()
which can return anAxisPair
containing the analog values of aSingleAxis
,DualAxis
, orVirtualDPad
. - Added
ActionState::action_value()
which represents the floating point value of any action:1.0
or0.0
for pressed or unpressed button-like inputs- a value (typically) in the range
-1.0..=1.0
for a single axis representing its analog input - or a value (typically) in the range
0.0..=1.0
for a dual axis representing the magnitude (length) of its vector.
- If no gamepad is registered to a specific
InputMap
, inputs from any gamepad in theGamepads
resource will be used. - Removed the
ActionState::reasons_pressed
API.- This API was quite complex, not terribly useful and had nontrivial performance overhead.
- This was not needed for axislike inputs in the end.
- Added
Direction::try_new()
to fallibly create a newDirection
struct (which cannot be created from the zero vector). - Removed the
InputMode
enum.- This was poorly motivated and had no internal usages.
- This could not accurately represent more complex compound input types.
ButtonKind
was renamed toInputKind
to reflect the new non-button input types.- Renamed
AxisPair
toDualAxisData
.DualAxisData::new
now takes twof32
values for ergonomic reasons.- Use
DualAxisData::from_xy
to construct this directly from aVec2
as before.
- Rotation is now measured from the positive x axis in a counterclockwise direction. This applies to both
Rotation
andDirection
.- This increases consistency with
glam
and makes trigonometry easier.
- This increases consistency with
- Added
Direction::try_from
which never panics; consider using this in place ofDirection::new
. - Converting from a
Direction
(which uses aVec2
off32
's internally) to aRotation
(which uses exact decidegrees) now has special cases to ensure all eight cardinal directions result in exact degrees.- For example, a unit vector pointing to the Northeast now always converts to a
Direction
with exactly 1350 decidegrees. - Rounding errors may still occur when converting from arbitrary directions to the other 3592 discrete decidegrees.
- For example, a unit vector pointing to the Northeast now always converts to a
InputStreams
andMutableInputStreams
no longer store e.g.Option<Res<Input<MouseButton>>>
, and instead simply storeRes<Input<MouseButton>>
- This makes them much easier to work with and dramatically simplifies internal logic.
InputStreams::from_world
no longer requires&mut World
, as it does not require mutable access to any resources.- Renamed
InputMocking::send_input_to_gamepad
andInputMocking::release_input_for_gamepad
toInputMocking::send_input_as_gamepad
andInputMocking::send_input_as_gamepad
. - Added the
guess_gamepad
method toInputStreams
andMutableInputStreams
, which attempts to find an appropriate gamepad to use. InputMocking::pressed
andpressed_for_gamepad
no longer require&mut self
.UserInput::raw_inputs
now returns aRawInputs
struct, rather than a tuple struct.- The
mouse
andkeyboard
fields on the twoInputStreams
types are now namedmouse_button
andkeycode
respectively.
- mocked inputs are now sent at the low-level
Events
form, rather than in theirInput
format.- this ensures that user code that is reading these events directly can be tested accurately.
- fixed a compilation error caused by mistakenly renaming the macros crate
- reduced required
derive_more
features - removed
thiserror
dependency - the order of all methods on
InputMap
is now(input, action)
, rather than(action, input
) to better match user mental models- this is a map-like struct: one presses
KeyCode::F
toActions::PayRespects
, not the other way around! - this includes the order of all paired tuples, including the returned values
- this is a map-like struct: one presses
- fixed serious bug that broke all functionality relating to durations that buttons were pressed or released for
ActionState::tick
now takes theInstant
of both the current and previous frame, rather than just the current
InputManagerPlugin
no longer panics when time does not have a previous update- this is useful as it ensures
bevy_inspector_egui
compatibility!
- this is useful as it ensures
- properly documented the
ToggleActions
functionality, for dynamically enabling and disabling actions - added doc examples to
ActionStateDriver
, which allows you to trigger actions based on entity properties - document the need to add system ordering when you have other functionality running during
CoreStage::PreUpdate
- hint to users that they may want to use multiple
Actionlike
enums
- added
reasons_pressed
API onActionState
, which records the triggering inputs- you can use this to extract exact input information from analog inputs (like triggers or joysticks)
- added the ability to release user inputs during input mocking
- added
ActionState::consume(action)
, which allows you to consume a pressed action, ensuring it is not pressed until after it is otherwise released - added geometric primitives (
Direction
andRotation
) for working with rotations in 2 dimensions- stay tuned for first-class directional input support!
- if desired, users are now able to use the
ActionState
andInputMap
structs as standalone resources - reverted change from by-reference to by-value APIs for
Actionlike
types- this is more ergonomic (derive
Copy
when you can!), and somewhat faster in the overwhelming majority of uses
- this is more ergonomic (derive
- relaxed
Hash
andEq
bounds onActionlike
InputManagerPlugin::run_in_state
was replaced withToggleActions<A: Actionlike>
resource which controls whether or not the [ActionState
] / [InputMap
] pairs of typeA
are active.ActionState::state
andset_state
methods renamed tobutton_state
andset_button_state
for clarity- simplified
VirtualButtonState
into a trivial enumButtonState
- other metadata (e.g. timing information and reasons pressed) is stored in the
ActionData
struct - users can now access the
ActionData
struct directly for each action in aActionState
struct, allowing full manual control for unusual needs
- other metadata (e.g. timing information and reasons pressed) is stored in the
- removed a layer of indirection for fetching timing information: simply call
action_state.current_duration(Action::Jump)
, rather thanaction_state.button_state(Action::Jump).current_duration()
- fleshed out
ButtonState
API for better parity withActionState
- removed
UserInput::Null
: this was never helpful and bloated match statements- insert this resource when you want to suppress input collection, and remove it when you're done
- renamed the
InputManagerSystem::Reset
system label toInputManagerSystem::Tick
. - refactored
InputMap
- removed methods that works with specific input mode.
- removed
n_registered
, useget(action).len()
instead. - added
insert_at
/remove_at
to insert / remove input at specific index. - added
remove
remove input for specific mapping. - use
usize
for sizes as in other Rust containers.
- added
UserInput::raw_inputs
, which breaks down aUserInput
into the constituent Bevy types (e.g.KeyCode
andMouseButton
)
- the
PartialOrd
implementation ofTiming
now correctly compares values on the basis of the current duration that the button has been held / released for
- configure how "clashing" inputs should be handled with the
ClashStrategy
field of yourInputMap
- very useful for working with modifier keys
- if two actions are triggered
- ergonomic input mocking API at both the
App
andWorld
level using theMockInputs
trait - send
ActionState
across the network in a space-efficient fashion using theActionDiff
struct- check out (or directly use) the
process_action_diff
andgenerate_action_diff
systems to convert these to and fromActionStates
- add
InputManagerPlugin::server()
to your serverApp
for a stripped down version of the input management functionality
- check out (or directly use) the
InputMap::new()
andInputMap::insert_multiple
now accept an iterator of(action, input)
tuples for more natural construction- better decoupled
InputMap
andActionState
, providing anInputMap::which_pressed
API and allowingActionState::update
to operate based on anyHashSet<A: Actionlike>
of pressed virtual buttons that you pass in InputMap
now uses a collectedInputStreams
struct in all of its methods, and input methods are now optionalInputManagerPlugin
now works even if some input stream resources are missing- added the
input_pressed
method toInputMap
, to check if a single input is pressed - renamed
InputMap::assign_gamepad
toInputMap::set_gamepad
for consistency and clarity (it does not uniquely assign a gamepad) - removed
strum
dependency by reimplementing the funcitonality, allowing users to define actions with only theActionlike
trait - added the
get_at
andindex
methods on theActionlike
trait, allowing you to fetch a specific action by its position in the defining enum and vice versa Copy
bound onActionlike
trait relaxed toClone
, allowing you to store non-copy data in your enum variantsClone
,PartialEq
andDebug
trait impls forActionState
get_pressed
,get_just_pressed
,get_released
andget_just_released
methods onActionState
, for conveniently checking many action states at once
- the
ActionState
component is no longer marked asChanged
every frame InputManagerPlugin::run_in_state
now actually works!- virtually all methods now take actions and inputs by reference, rather than by ownership, eliminating unnecessary copies
- added
set_state
method, allowing users to transferVirtualButtonState
betweenActionState
without losingTiming
information
- fixed minor mistakes in documentation
- fix failed
strum
re-export; users will need to pull in the derive macroEnumIter
themselves- thanks to
@Shatur
for noticing this
- thanks to
- Released!