buttondescriptor - eisclimber/ExPresS-XR GitHub Wiki

ButtonDescriptor

Class in ExPresSXR.Interaction.ValueRangeInteractable

Inherits from ValueDescriptor\<V\>

Summary

Represents the internal press value of a button represented by a value between 0.0f (up-position) and 1.0f (down-position). Allows customizing the press threshold and deadzone and repress timeouts, whilst also supporting an optional toggle mode.

public class ButtonDescriptor : ValueDescriptor<float>

Fields

Name Description
OnPressed Emitted if the button is in the pressed position and the action is considered a press.
OnReleased Emitted if the button is in the pressed position and the action is considered a release.

Methods

Name Description
IsMaxValue(float) Checks if the provided value is considered maximal.
IsMinValue(float) Checks if the provided value is considered minimal.
IsValueSnappingEnabled() Allows checking if snapping is enabled and is used internally to emit the correct events.
This function must be implemented as snapping must be implemented individually. If no snapping will be performed, simply return false.

Properties

Name Description
DefaultMaxValue Accessor defining the default max value.
There can be multiple max values, but this is the one used in the editor for setting the value.
Make sure it evaluates to a valid max value according to IsMaxValue(V) .
DefaultMinValue Accessor defining the default min value.
There can be multiple min values, but this is the one used in the editor for setting the value.
Make sure it evaluates to a valid min value according to IsMinValue(V) .
ForceUpdatePressState Helper value to ignore the repress timeout temporarily for the editor. Resets automatically after the next press/release.
PressDeadzone Deadzone around the press threshold in BOTH directions to avoid rapid pressing/releasing.
If the deadzone expands beyond 0.0f or 1.0f, it will be clamped and the press/release events will be fired at exactly 0.0f or 1.0f.
Pressed Bool wrapper for checking if the button is pressed (i.e. value = 1.0f) or not.
PressThreshold The threshold beyond which the button is considered pressed.
RepressTimeout Time after which the button can be re-pressed after being pressed.
Value Inheriting directly from ValueDescriptor and redefining value here to add the Range-attribute.
This property is readonly in the inspector as the value is managed via the "pressed" function.
⚠️ **GitHub.com Fallback** ⚠️