C Specification

The xrApplyHapticFeedback function is defined as:

XrResult xrApplyHapticFeedback(
    XrAction                                    hapticAction,
    uint32_t                                    countSubactionPaths,
    const XrPath*                               subactionPaths,
    const XrHapticBaseHeader*                   hapticEvent);

Parameters

Parameter Descriptions
  • hapticAction is the XrAction handle for the desired output action.

  • countSubactionPaths is the number of elements in the subactionPaths array. If subactionPaths is NULL, this parameter must be 0.

  • subactionPaths is an array of paths or NULL. If this array is specified, it contains one or more subaction paths that were specified when the action was created. If the array includes a subaction path that was not specified when the action was created the runtime must return XR_ERROR_PATH_INVALID. If this parameter is specified, the runtime must trigger haptic events only on devices represented in the array.

  • hapticEvent is a pointer to a haptic event structure which starts with an XrHapticBaseHeader.

Description

Triggers a haptic event through the specified action of type XR_TYPE_ACTION_STATE_POSE. The runtime should deliver this request to the appropriate device, but exactly which device, if any, this event is sent to is up to the runtime to decide. If an appropriate device is unavailable the runtime may ignore this request for haptic feedback.

If another haptic event from this session is currently happening on the device bound to this action, the runtime must interrupt that other event and replace it with the new one.

See XrActionCreateInfo for a description of subaction paths, and the restrictions on their use.

Valid Usage (Implicit)
  • hapticAction must be a valid XrAction handle

  • If countSubactionPaths is not 0, countSubactionPaths must be a valid uint32_t value

  • If countSubactionPaths is not 0, subactionPaths must be a pointer to an array of countSubactionPaths XrPath values

  • hapticEvent must be a pointer to a valid XrHapticBaseHeader structure

Return Codes
On success, this command returns
  • XR_SUCCESS

  • XR_SESSION_LOSS_PENDING

On failure, this command returns
  • XR_ERROR_INSTANCE_LOST

  • XR_ERROR_SESSION_LOST

  • XR_ERROR_RUNTIME_FAILURE

  • XR_ERROR_HANDLE_INVALID

  • XR_ERROR_VALIDATION_FAILURE

  • XR_ERROR_ACTION_TYPE_MISMATCH

  • XR_ERROR_SESSION_NOT_RUNNING

See Also

Document Notes

For more information, see the OpenXR Specification at URL

This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.

Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.