Skip to content

Deadzone clipping in AxisSettings and ButtonSettings results in a compression of values #3450

@alice-i-cecile

Description

@alice-i-cecile

Problem

The current behavior of AxisSettings is:

  • If an axis's value is below the low-threshold, set them to 0.0.
  • If an axis's is above the high-threshold, set them to 1.0.

This is sensible enough, and it's useful to be able to configure this in order to control dead zones and partially account for controller drift.

However, this results in a compression of values: rather than the controller always being able to send values from -1.0 to 1.0, they can only send values in a restricted range: the high, low and near-zero values are just clipped out.

This is undesirable because it causes player-configurable settings which are intended to account for strange quirks in physical controller behavior to have unintuitive and far-reaching gameplay effects.

The same effect occurs for analogue buttons like triggers in ButtonSetttings.

Proposed Solution

Rescale values to cover the full range regardless of the configuration. The formula (for positive values) is:

let new_value = (value - positive_low) / (positive_high - positive_low);

If the game cares about the original raw input values instead, they can intercept the event stream themselves.

Alternatives

Make this a configurable setting, and keep the current behavior if the rescale_values field in the AxisSettings is set to false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-InputPlayer input via keyboard, mouse, gamepad, and moreC-BugAn unexpected or incorrect behaviorD-TrivialNice and easy! A great choice to get started with Bevy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions