The Meta Quest Head Tracking App is a real-time head-tracking application for Meta Quest users. Developed with the LibOVR library, it leverages the Oculus SDK to interact with the Meta Quest headset, capturing the position and orientation of the user’s head at any given moment.
This project utilizes the Oculus SDK and other supporting material provided by Meta. The Oculus SDK and other supporting material are subject to the Oculus proprietary license.
- Ensure no other Meta software is installed
- Connect Quest to PC via USB-C
- Set up Meta Quest Link here
- Download Oculus SDK for Windows here
- Create project folder "MetaApp"
- Copy LibOVR library to MetaApp folder (From Oculus SDK folder)
- Create a Text Document and name it "CMakeLists.txt".
- Create a C++ source file and name it "main.cpp".
- Create a new folder in the MetaApp folder and name it "build".
Write the following code in CMakeLists.txt. Make sure to set your LibOVR path correctly:
cmake_minimum_required(VERSION 3.10)
project(MetaApp)
set(CMAKE_CXX_STANDARD 14)
#Specify the path to your LibOVR installation
set(LIBOVR_PATH C:/Users/your_LibOVR_folder_path)
include_directories(${LIBOVR_PATH}/Include)
link_directories(${LIBOVR_PATH}/Lib/Windows/x64/Release/VS2017)
add_executable(MetaApp main.cpp)
target_link_libraries(MetaApp LibOVR)
Write the following code in main.cpp:
#include <OVR_CAPI.h>
#include <iostream>
int main() {
std::cout << "Starting program...\n";
if (ovr_Initialize(nullptr) == ovrSuccess) {
std::cout << "LibOVR initialized successfully.\n";
ovrSession session;
ovrGraphicsLuid luid;
ovrResult result = ovr_Create(&session, &luid);
if (result == ovrSuccess) {
std::cout << "Session created successfully.\n";
while (true) {
ovrTrackingState ts = ovr_GetTrackingState(session, ovr_GetTimeInSeconds(), true);
if (ts.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)) {
ovrPosef pose = ts.HeadPose.ThePose;
std::cout << "Position: (" << pose.Position.x << ", " << pose.Position.y << ", " << pose.Position.z << ")\n";
std::cout << "Orientation: (" << pose.Orientation.x << ", " << pose.Orientation.y << ", " << pose.Orientation.z << ", " << pose.Orientation.w << ")\n";
}
}
ovr_Destroy(session);
} else {
std::cout << "Failed to create session. Error: " << result << "\n";
}
ovr_Shutdown();
} else {
std::cout << "Failed to initialize LibOVR.\n";
}
return 0;
}
- Download and install CMake from here
- Open CMake and click “Browse Source”, then choose the MetaApp folder.
- Click “Browse Build” and choose the “build” folder in the MetaApp folder.
- Click on “Generate”.
- Open the Command Prompt (CMD) on your windows and navigate to the “build” folder with this command:
cd C:\Users\your_build_folder_path
- Compile the project:
cmake --build .
- After the build process is complete, you should see your “Debug” folder in the build directory which includes MetaApp.exe.
- You can run the application directly from the command line:
cd Debug
.\MetaApp.exe
Note: Instead of steps 1 to 4, you can open CMD, navigate to your “build” directory, and write:
cd C:\Users\your_build_folder_path
cmake ..
Please replace your_LibOVR_folder_path
and your_build_folder_path
with the actual paths on your system.
Mohammad Elahi, TU Dresden, Vodafone Chair, [email protected]
If you use this software in your research, please cite it as follows:
Elahi, M. (2024). MetaQuest-HeadTracker_App: The Meta Quest Head Tracking App is a real-time head-tracking application for Meta Quest users. GitHub. https://github.com/Mohammad-Elahi/MetaQuest-HeadTracker_App
For BibTeX:
@software{Elahi2024,
author = {Elahi, Mohammad},
title = {MetaQuest-HeadTracker_App: The Meta Quest Head Tracking App is a real-time head-tracking application for Meta Quest users},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
url = {https://github.com/Mohammad-Elahi/MetaQuest-HeadTracker_App}
}