Skip to main content

Finger Distance

Description

FingerDistance, based on VRNativeApplicationAdvanced, measures the distance between both index fingers and visualizes this distance in VR. This app is an excellent introduction to hand interaction and the visualization of simple 3D objects.

Image: Screenshot of the Finger Distance app

The demo app initializes the necessary rendering objects after the framebuffer has been set up in the onFramebufferInitialized() function. It creates a small sphere object for the tip of each index finger, a cylinder to indicate the connection between the two fingers, and a text object to display the distance between the fingertips.

Before rendering each new frame, the onPreRender() event function is called. This function serves as the ideal location to modify the appearance of objects and to implement the application logic of the experience. The demo app accesses the poses of both hands and extracts the 3D positions of the tips of the index fingers. If the two fingers are tracked, the code updates the positions of the spheres and calculates a 6-DOF transformation for the cylinder and the text object. This ensures that the cylinder visually connects both fingers and that the text is always oriented towards the user.

As the app relies on hand tracking, the hand tracking capability com.oculus.permission.HAND_TRACKING is included in the app's manifest file. Without this capability configured, hand tracking will not function, and the app will be unable to access hand poses.

Building

The following instructions are for macOS but can be easily converted to other host operating systems. First, ensure that the

have been completed. And that the third-party libraries have been built according to these instructions.

Then run the following steps:

# Define environment variables required for Android and Quest apps as per setup instructions above:
# ANDROID_HOME, ANDROID_NDK, ANDROID_NDK_VERSION, JAVA_HOME, and OVRPlatformSDK_ROOT

# Adjust this to your location of the third-party libraries
export OCEAN_THIRDPARTY_PATH="${HOME}/install_ocean_thirdparty"

cd ${OCEAN_DEVELOPMENT_PATH}/build/gradle/application/ocean/demo/platform/meta/quest/openxr/fingerdistance/quest

./gradlew assemble

# Install debug build of the app
adb install app/build/outputs/apk/debug/app-debug.apk

# Install release build of the app
adb install app/build/outputs/apk/release/app-release.apk

Features

  • Distance Measurement and Visualization: Measures and visually represents the distance between index fingers in VR.
  • Simple 3D Object Visualization: Demonstrates visualization of spheres, cylinders, and text.

Use case

  • Educational Tool: Serves as a practical example for developers interested in creating educational or training applications focused on hand interactions.