Get Started With Haptics SDK
By the end of this guide, you will be able to:
- Explain what is needed to use the Haptics Native SDK
- Remember the steps to set up the Haptics Native SDK and layout the content of the asset.
- Perform the steps for installing and setting up the Haptics Native SDK
- Learn how to get started with the C++ example app, demonstrating the integration of the SDK in an OpenXR application
You can use the Haptics Native SDK on Meta Quest headsets directly (Android) and on PC (Windows). Please make sure you have the following:
- Headset: Using the SDK on headsets directly is supported for Meta Quest 2 and later. On PC, any headset is supported, including non-Meta headsets.
- Controllers: High-fidelity haptics are supported on Meta Touch Pro, Meta Touch Plus and later controllers. On other controllers, the SDK will use lower fidelity haptics with a fixed vibration frequency.
- Runtime: On PC, high-fidelity haptics are supported with Meta’s OpenXR runtime. With other runtimes, such as SteamVR, the SDK will use lower fidelity haptics with a fixed vibration frequency.
- API: Your application needs to use OpenXR. Older deprecated APIs, such as VrApi, CAPI and OpenVR, are not supported. You need to be in control of the code that creates and binds the OpenXR actions, as you need to integrate the SDK into that code.
Download and asset contents
Asset contents
The SDK is a zip file with the following content:
include/
: Contains the header file, haptics_sdk.h
.
- The header file also contains API documentation that can provide additional information.
lib/
: Contains the shared library, which is libhaptics_sdk.so
for Android and haptics_sdk.dll
for Windows.
- For Android, there are two versions, one for ARM64 (64 bit,
arm64_v8a/
) and one for ARMv7 (32 bit, armeabi_v7a/
). Choose the one for your target platform, or both if you are creating a multi-arch application.
example_app/
: Contains a minimal C++ example app that demonstrates how to integrate and use the SDK. For more info, please see the section about the example app below.haptic_samples/
: Contains a small collection of haptic clips designed by Meta to get you started. If you are designing your own haptics exclusively, and have no need for samples, it’s safe to remove this folder.
- Copy the header file into your project and make sure the directory is included in the include directory list of your compiler.
- Copy the shared library into your project and add it to your linker’s list of linked libraries.
- Include the shared library in your application package so your application can find and load the library at startup.
If using CMake, you can look at the example app to see how to add the SDK. For Windows, see example_app/CMakeLists.txt
, and for Android, example_app/app/src/main/cpp/CMakeLists.txt
. In summary, your CMakeLists.txt
should include the following:
add_library(haptics_sdk SHARED IMPORTED)
# Windows
set_target_properties(
haptics_sdk PROPERTIES
IMPORTED_LOCATION "path/to/sdk/lib/x86-64/haptics_sdk.dll"
IMPORTED_IMPLIB "path/to/sdk/lib/x86-64/haptics_sdk.lib")
# Android
set_property(
TARGET haptics_sdk
PROPERTY IMPORTED_LOCATION
"path/to/sdk/lib/arm64_v8a/libhaptics_sdk.so")
target_include_directories(my_project PRIVATE "path/to/sdk/include")
target_link_libraries(my_project haptics_sdk)
# Windows
add_custom_command(
TARGET my_project POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"path/to/sdk/lib/x86-64/haptics_sdk.dll"
$<TARGET_FILE_DIR:my_project>)
The Haptics SDK includes a C++ example app, based on OpenXR and OpenGL. The app can either be built to run on a Meta Quest headset, or to run on Windows and stream to a headset, including non-Meta headsets.
The example demonstrates how to integrate the Haptics Native SDK into an OpenXR application. The app is minimal: it only renders a single quad, and only uses the basic playback feature of the SDK. Mainly, it shows how to handle the SDK initialization, which requires multiple steps that are closely tied to the OpenXR initialization.
You can find the example app in the example_app/
folder of the SDK. See the README.md
file in there for instructions on how to build and run the example.