API

Type Alias WebXRControllerMovementRegistrationConfiguration

WebXRControllerMovementRegistrationConfiguration: {
    allowedComponentTypes?: MotionControllerComponentType[];
    componentSelectionPredicate?: (
        xrController: WebXRInputSource,
    ) => Nullable<WebXRControllerComponent>;
    forceHandedness?: XRHandedness;
    mainComponentOnly?: boolean;
} & (
    | {
        axisChangedHandler: (
            axes: IWebXRMotionControllerAxesValue,
            movementState: WebXRControllerMovementState,
            featureContext: WebXRControllerMovementFeatureContext,
            xrInput: WebXRInput,
        ) => void;
    }
    | {
        buttonChangedHandler: (
            pressed: IWebXRMotionControllerComponentChangesValues<boolean>,
            movementState: WebXRControllerMovementState,
            featureContext: WebXRControllerMovementFeatureContext,
            xrInput: WebXRInput,
        ) => void;
    }
)

Button of Axis Handler must be specified.

Type Declaration

  • OptionalallowedComponentTypes?: MotionControllerComponentType[]

    handlers are filtered to these types only

  • OptionalcomponentSelectionPredicate?: (xrController: WebXRInputSource) => Nullable<WebXRControllerComponent>

    Additional predicate to apply to controllers to restrict a handler being added.

  • OptionalforceHandedness?: XRHandedness

    For registering movement to specific hand only. Useful if your app has a "main hand" and "off hand" for determining the functionality of a controller.

  • OptionalmainComponentOnly?: boolean

    For main component only (useful for buttons and may not trigger axis changes).