HoloKit is an optical see-through mixed reality headset that transforms your iPhone into a powerful stereoscopic AR device. With the HoloKit Unity SDK, developers can create immersive AR experiences in Unity, which can be viewed with HoloKit headset.
The SDK currently provides three core features:
- Stereoscopic Rendering
- Hand Tracking
- Hand Gesture Recognition
Stereoscopic rendering is the central feature of the SDK, allowing for the display of stereo images on the iPhone screen. By attaching your iPhone to the HoloKit, you can enjoy a captivating AR experience. Utilizing Apple Vision framework, the SDK detects user hand poses. Together with LiDAR depth sensor, it allows your iPhone to track the 3D positions of the user's hands. Furthermore, the SDK can recognize hand gestures such as pinching, serving as a trigger for specific operations in your project.
The SDK offers a built-in video recording feature which allows the user to record videos under both screen AR mode and stereoscopic mode.
HoloKit Unity SDK, built on the foundation of ARFoundation, is compatible with most ARFoundation features such as image tracking and plane detection. Upgrading your ARFoundation project to a stereoscopic AR project is straightforward with the HoloKit Unity SDK.
You can install HoloKit Unity SDK from the following git URL in Package Manager:
https://github.com/holokit/holokit-unity-sdk.git
![image](https://private-user-images.githubusercontent.com/44870300/239860638-a82656c9-aa73-4158-83b5-20d5178c8a81.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yMzk4NjA2MzgtYTgyNjU2YzktYWE3My00MTU4LTgzYjUtMjBkNTE3OGM4YTgxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwNjAyZmEwZjE1ZmIzM2Q0MmQwYzQzZDJkOGMwODNkZDcyNjEyZTJkM2FkYjQ2YWI0MjZjMjkwZDA3MmY2OTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lC7dMREthO--Fk8dF48qfYF6ucLCdwU5P8WTTUkyjHI)
or by directly adding the following line to the Packages/manifest.json
file.
"io.holokit.unity-sdk": "https://github.com/holokit/holokit-unity-sdk.git"
HoloKit Unity SDK has been tested and found compatible with the following software versions:
- Unity 2022.3 LTS
- ARFoundation 5.1
We aim to continually test and verify compatibility with newer versions of these softwares.
HoloKit was primarily built for iOS devices. Please see the Supported iOS Devices to check if your iPhone is supported.
HoloKit currently only supports a limited number of Android phones. Please see the Supported Android Devices for more details.
If your Android phone is not supported, we also provide a calibration method to let you figure out the specs of your Android phone yourself. You can then enter your Android phone specs to the SDK to have your device rendering stereo images. Please see Phone Calibration Guide, which is a step-by-step guide on how to figure out the specs of your phone model.
Before using the HoloKit Unity SDK, ensure to adjust the project settings to meet ARFoundation's requirements. If you are already comfortable with ARFoundation, feel free to skip this section.
Upon successfully installation of the SDK package, the ARFoundation package will be installed automatically. Please note that the HoloKit Unity SDK is only compatible with ARFoundation 5.+. If you are using ARFoundation 4.+, please update to a more recent version.
For iOS-targeted projects, install the Apple ARKit XR Plugin
package. For Android-targeted projects, the Google ARCore XR Plugin
is required.
- Set Camera and Microphone Usage Descriptions: Navigate to
Project Settings > Player > Other Settings > Configuration
and provide a user-friendly text forCamera Usage Description
andMicrophone usage description
. TheCamera Usage Description
will pop up when the iPhone requests access to the camera. TheMicrophone usage description
is required because the video recording feature of the SDK will access the microphone to record audio.
![image](https://private-user-images.githubusercontent.com/44870300/293865981-848a1bf3-b877-48a0-8430-92d2d448c7a5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTM4NjU5ODEtODQ4YTFiZjMtYjg3Ny00OGEwLTg0MzAtOTJkMmQ0NDhjN2E1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwYTE3MWZlM2IxZGEwMzkzMTdjZWNlNmUyYTY5M2YwYTE4MDVlMzA1MzNhNWRjYjUyZDhmNTdhMDNhNDVhMGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.18v38zQORmZHMwLafT1KwME3EccQc0DPPyi311SJARA)
- Enable Apple ARKit: Under
Project Settings > XR Plug-in Management > Plug-in Providers
, enable theApple ARKit
option.
![Enable Apple ARKit](https://private-user-images.githubusercontent.com/44870300/251086976-ab5f3554-9530-464d-a336-12957a857192.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNTEwODY5NzYtYWI1ZjM1NTQtOTUzMC00NjRkLWEzMzYtMTI5NTdhODU3MTkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFiNGZiNzQwOThmOGI4ZDBmZDA5MGQwNTE5YTcxMWQ4YTg0MDI5N2ViNzZhNjViYWNkZGZiMDQyZjM4NDhjYmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YmabMezIlGorXpTFf-GYclymbS14XXjibLsChNlq9BU)
- Disable Auto Graphics API: Navigate to
Project Settings > Player > Other Settings > Rendering
and disableAuto Graphics API
. In theGraphics APIs
list, removeVulkan
and ensure onlyOpenGLES3
is listed.
![Graphics APIs](https://private-user-images.githubusercontent.com/44870300/251082187-4f66611d-d912-4fe8-b4d9-ca1a08e15a5d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNTEwODIxODctNGY2NjYxMWQtZDkxMi00ZmU4LWI0ZDktY2ExYTA4ZTE1YTVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNmMWQwZmRhMGUwMDAxMjlhMGVlZDk5ZGRhNjc5MzY3OWQwNDAyNTYyYzFiYzU0ZDc0NDk3Yjc4NzRkMzY1YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.A49xkvQpxbtYjj6-ji-cjXgzIhrwxU4YZWJLQeTCedA)
- Set Minimum API Level: Proceed to
Project Settings > Player > Other Settings > Identification
and setMinimum API Level
toAndroid 7.0 'Nougat' (API level 24)
or higher.
![Minimum API Level](https://private-user-images.githubusercontent.com/44870300/251082460-fb16a187-651c-4ace-b266-77f2e18f67dc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNTEwODI0NjAtZmIxNmExODctNjUxYy00YWNlLWIyNjYtNzdmMmUxOGY2N2RjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcwYmI1OWU5NTI0Nzk0YmEwZjE3M2NmZWQxOTgxYWI4NGIzNGM1ZWQ0NjliNTAxYjE2NDZjNDJhNmM3ZDY4ZmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.X67UhT-N4J8XxV20Bmi1tMy3y3XbUHCP9o01Popgy7w)
- Configure Scripting Backend: In
Project Settings > Player > Other Settings > Configuration
, setScripting Backend
toIL2CPP
. UnderTarget Architectures
, uncheckARMv7
and checkARM64
.
![Configuration](https://private-user-images.githubusercontent.com/44870300/251082715-049fc7a9-e8a2-4b21-8e1c-cf241df6aa3c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNTEwODI3MTUtMDQ5ZmM3YTktZThhMi00YjIxLThlMWMtY2YyNDFkZjZhYTNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1ZmI5YjM5NDIwN2NhNjRlNTQ4YjMzNjFkYTEyOWM2ZTkzOWI2ZmU5M2IyZjUyZTdhNzA0MWY5OWFhMjQ5ZTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.q6FRyv2RfG-3aMokev0pSQrXHwf63j9NgU31PJHRh-8)
- Enable Google ARCore: Under
Project Settings > XR Plug-in Management > Plug-in Providers
, enable theGoogle ARCore
option.
![Enable Google ARCore](https://private-user-images.githubusercontent.com/44870300/251087222-daccfe62-c90e-4ed3-8fcc-218bcae59a31.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNTEwODcyMjItZGFjY2ZlNjItYzkwZS00ZWQzLThmY2MtMjE4YmNhZTU5YTMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIyNGQ4MDU5OGRhOTkwZTIwOTdkZjY4ZTY3ZDU2ZjE0ODU4MTM5MjRhYjdkY2RmYTU5NTM5NDZiYTRiZWU0ZjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DU-jINu3U-GxX_tkeGS9oGy5MbEXlbcs-B9MgohvADY)
The SDK package offers a samples for each of the three key features: stereoscopic rendering, hand tracking, and hand gesture recognition. Import these samples into your project and deploy them to mobile devices for a quick overview of each feature. These samples can also be used as templates for your projects.
Stereoscopic rendering is the core feature of the SDK, your app needs to display stereo images on the phone screen so that it can be viewed with the HoloKit headset.
The SDK provides two rendering modes: mono and stereo. Mono mode renders the background camera image with virtual content layered on top, akin to a standard ARFoundation project. In constrast, stereo mode renders two stereo images on a black background one the phone's screen, so that you can insert your phone onto the HoloKit headset to have stereoscopic AR experience.
Mono rendering mode | Stereo rendering mode |
To integrate stereoscopic rendering into your project, the HoloKitCameraManager
component is required. In fact, HoloKitCameraManager
is the only mandatory component in the SDK that you must add into the scene. Instead of adding a default ARFoundation XR Origin
object, we add a HoloKit XR Origin
object into the scene by right-clicking in Unity Editor's hierarchy window and selecting XR/HoloKit/HoloKit XR Origin
. The HoloKit XR Origin
contains a HoloKit Camera
object with the HoloKitCameraManager
script, which enables both mono and stereo rendering modes.
![image](https://private-user-images.githubusercontent.com/44870300/294419347-a5d5a3d8-c600-405f-8743-a5266d024368.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTQ0MTkzNDctYTVkNWEzZDgtYzYwMC00MDVmLTg3NDMtYTUyNjZkMDI0MzY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ5YzczODgxMzA0YzgxMzk0YWY1NWI2ZDY4NTdmY2E5NGY2MzcwZjllMTM4OTUyZmFlOTU1YTIxNjg3YWFlOTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OuFVuSR9vwc7gWm8C4uBqcHRNe_mQp87nL-Sbo-8fvs)
When you start the game, HoloKitCameraManager
initially enters mono mode. A UI button is required to transition between rendering modes. The current rendering mode can be retrieved and set with HoloKitCameraManager
. The following code snippet illustrates how to switch the rendering mode.
// A reference to the HoloKitCameraManager component is required
[SerializedField] HoloKitCameraManager m_HoloKitCameraManager;
public void SwitchRenderMode()
{
// Get the current ScreenRenderMode value and assign a new value
holokitCamera.ScreenRenderMode = holokitCamera.ScreenRenderMode == ScreenRenderMode.Mono ? ScreenRenderMode.Stereo : ScreenRenderMode.Mono;
}
When the stereo mode is activated, the SDK spawns an alignment marker UI on the screen's upper right corner, enabling you to align your phone accurately once attached to the HoloKit headset.
The SDK tracks the user's hand, providing the 3D positions of the 21 hand joints of each hand.
To incorporate the hand tracking into your project, create an empty GameObject and add HandTrackingManager
component to it. The script will automatically setup all necessary objects as child GameObjects.
![HandTrackingManager](https://private-user-images.githubusercontent.com/44870300/249066050-54c5dc5e-ca2b-4cac-b132-d1aab5f47fa0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNDkwNjYwNTAtNTRjNWRjNWUtY2EyYi00Y2FjLWIxMzItZDFhYWI1ZjQ3ZmEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwY2YxYTJlMWZhYTFmNDc3ODFmYjVjYTk5ZjdlY2E1MmJhZDc4MDBjYWVjNGFjMmUyNDVkMTc1NTdlY2U4NTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.SIH0VtZGWugqBubzQSis8ZEsRivZ9Ft3UVJANdAUMfU)
HandTrackingManager
requires depth information to calculate 3D hand positions, so add AROcclusionManager
component to the HoloKit Camera
GameObject and adjust its settings accordingly.
![image](https://private-user-images.githubusercontent.com/44870300/294420739-e38f3c36-a673-46ec-a41c-339572fc11a5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTQ0MjA3MzktZTM4ZjNjMzYtYTY3My00NmVjLWE0MWMtMzM5NTcyZmMxMWE1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdkMWNiYTM1ZDFmMjlmMTJjMDZkNGE0ZDE1MjVlOWJjNTYxYWZlMGEzOWRkNTk5MWM3YzY5M2FmZWVlYzg2MzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.aGN7FW62qyZBkrIUaHlN9kqYRDFwT35kLLP_oUjCJtE)
You can now build the project onto an iPhone to view the results.
![Hand Tracking Result](https://private-user-images.githubusercontent.com/44870300/249321264-aba052ed-6433-41ba-9329-a6219364f7ea.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNDkzMjEyNjQtYWJhMDUyZWQtNjQzMy00MWJhLTkzMjktYTYyMTkzNjRmN2VhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYzMTU2ZDFhNTBmZmU1MDg2OTIwNzEyMzA1NjcwNjIyODVmOTM0YjExNTE4ZDIyZTVkN2FjMGRiYWExMzg2MTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LriEDc6vYFmotEgRwHaaA5oNuNzSmuTNTr266zsY7qE)
HandTrackingManager
can be configured to track either one hand or both hands. As hand tracking is energy-intensive, if dual hand tracking isn't necessary, we advise tracking only one hand to conserve energy. Set HandTrackingManager.MaxHandCount
in its inspector within the Unity editor.
To obtain specific hand joint positions in code, use HandTrackingManager.GetHandJointPosition(int handIndex, JointName jointName)
. As the hand tracking algorithm can't distinguish handedness, the parameter handIndex
simply represents the hand detection sequence. When only one hand is detected, handIndex
should always be 0. If two hands are detected, handIndex
can be either 0 or 1. The number of detected hands can be accessed via HandTrackingManager.HandCount
.
Please note, the hand tracking feature is only compatible with iOS 14.0 or higher devices equipped with a LiDAR depth sensor.
The SDK can also recognizes user's hand gesture, which can serve as input triggers in your project. Currently there are only two available hand gestures: HandGesture.None
and HandGesture.Pinched
.
![Hand Gesture Recognition](https://private-user-images.githubusercontent.com/44870300/249336605-0fe0010f-7854-41ad-b9b8-95ee8039fb4c.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yNDkzMzY2MDUtMGZlMDAxMGYtNzg1NC00MWFkLWI5YjgtOTVlZTgwMzlmYjRjLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI2YmY3NTQwYjY1ODg4MzhmMmQ3NjhhMmI3YWM3MDlkZDk4NDI1NWJhN2JlNzFjZmI1YTM2NzhlODkwMmY0YzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LSXoe8vLgzrUdxRTZpiwcq7GCm31Fd0m6waxNbULh6M)
To utilize hand gesture recognition, add HandGestureRecognitionManager
to the scene. The callback function HandGestureRecognitionManager.OnHandGestureChanged
is invoked when a hand gesture transition is detected. Register this callback to receive notifications. You can also access the user's current hand gesture via HandGestureRecognitionManager.HandGesture
. The following code snippet illustrates how to capture user hand gesture transitions.
[SerializeField] HandGestureRecognitionManager m_HandGestureRecognitionManager;
private void Start()
{
// Register the callback
m_HandGestureRecognitionManager.OnHandGestureChanged += OnHandGestureChanged;
}
private void OnHandGestureChanged(HandGesture handGesture)
{
// Execute desired action
}
Please note, the hand gesture recognition feature is only available on iOS 14.0 or higher devices.
You can use hand tracking and hand gesture recognition at the same time, simply add both HandTrackingManager
and HandGestureRecognitionManager
components to your scene.
HoloKit Unity SDK is based on ARFoundation. For a minimal ARFoundation scene requires two primary objects: an AR Session
object and an XR Origin
object with the Main Camera Object as its child.
![image](https://private-user-images.githubusercontent.com/44870300/293868208-feeb658f-ec65-4461-bf5a-e42fc423cafa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTM4NjgyMDgtZmVlYjY1OGYtZWM2NS00NDYxLWJmNWEtZTQyZmM0MjNjYWZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI4YWYwMzE1YzEwN2Q2OTY2Njg0ZTAwZDE4MmEyN2M0ZjZkNmM4ZGYzOGEzYzZhMmVmM2YzMTM2NjIxNjc2MjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ChqqFDO9g_KZqt4Mcee12TErX-TXOG7cXCeTC88GpHM)
To enable stereoscopic rendering, we need to upgrade the default Main Camera to a HoloKit Camera. To create an XR Origin
with a HoloKit Camera as its child, right-click in the Unity Editor and select XR/HoloKit/HoloKit XR Origin
to create a HoloKit XR Origin
.
![image](https://private-user-images.githubusercontent.com/44870300/293868774-ad56a592-147f-4969-9942-d3445bf038f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTM4Njg3NzQtYWQ1NmE1OTItMTQ3Zi00OTY5LTk5NDItZDM0NDViZjAzOGY2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzOTI2ZjhhODc4ZGEzYzc0OThjOWI5NjMxZDk0MzBkNDE2OTBjZTkyOWRkNzNhOTNjYWJhZGRmNTQ4OTYyYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-sX6BbOr_5cKn7-aYdjt7dwqK-EGHoj7DEukqoFra5c)
The HoloKit XR Orign
object includes a HoloKit Camera capable of both screen AR and stereoscopic rendering.
![image](https://private-user-images.githubusercontent.com/44870300/294418012-cdd3b0fa-6d69-45eb-9a8b-f129ce14df2a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTQ0MTgwMTItY2RkM2IwZmEtNmQ2OS00NWViLTlhOGItZjEyOWNlMTRkZjJhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMwYzJkYjYzNzdjMjMzNTEyNzY0OWVlMTMyNmQxNmZkNzk4NzVkYTRiZmI5MTE3NmZmMGZhYjQxMDdhNjcwOTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.BOdQWrLPeWtXm9MSOGgajokYVMx5wCmtZscNuLJ2IOg)
To switch between the rendering modes, a UI button is necessary. To create a default UI panel which includes this mode-switching button, right-click and navigate to UI/HoloKit/HoloKit Default UI Canvas
.
![image](https://private-user-images.githubusercontent.com/44870300/293870419-d3c5a561-43c2-48b4-9f24-cbb770b3e773.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTM4NzA0MTktZDNjNWE1NjEtNDNjMi00OGI0LTlmMjQtY2JiNzcwYjNlNzczLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM0MWRkMTIwMThmODA5YWU0MWMyMzBiYTQyMDIxMDIwZDljMWYzMmU4YzM2ZmIyM2E5MGQ4ZTc3MTU1N2RiNmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.juk9B6xlwHt6mZIVV_AeXmm-16zfwHHk2Y58gmLqp7g)
The default canvas also has a button for controlling video recording.
![image](https://private-user-images.githubusercontent.com/44870300/293869989-6daa7737-49e6-4403-9f95-a1eedd88506d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTM4Njk5ODktNmRhYTc3MzctNDllNi00NDAzLTlmOTUtYTFlZWRkODg1MDZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4MzFlMGJhMTJkNDViMzQyMDljNjRmN2QwMmVkYjcyYmI0OTZmY2NmOWFmOTkwYTJjMzZhZjYzOWE1NDY2NDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.UUNcp3Na3WFT-tWNYDo6F-mPf0gTPLBwJzmEjO60hsM)
After setting up the AR Session
, HoloKit XROrigin
, and UI components, you can add any 3D object to the scene, such as a cube. When you build your project onto an iPhone, you'll be able to view your object in both screen AR mode and stereoscopic rendering mode with a HoloKit headset.
The SDK enables resetting the ARKit ARSession
's world origin to a specified position and rotation by using the WorldOriginResetter
script. Please notice that there must be a HoloKitARKitManager
component in the scene, which is used by the WorldOriginResetter
script.
Import the Reset World Origin
package sample for how to use this feature.
The 4K HDR (High Dynamic Range) AR background video is a feature of ARKit 6, available on iOS 16 and later. This enhancement improves the quality of ARBackground video, leading to better video recording quality. To enable the 4K HDR option, use the ARBackgroundVideoEnhancementManager
component. Please notice that there must be a HoloKitARKitManager
component in the scene, which is used by the ARBackgroundVideoEnhancementManager
script.
![image](https://private-user-images.githubusercontent.com/44870300/294078134-24c9274f-d30c-47e3-acb3-10b7d0bce816.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MjYxMjUsIm5iZiI6MTcyNDUyNTgyNSwicGF0aCI6Ii80NDg3MDMwMC8yOTQwNzgxMzQtMjRjOTI3NGYtZDMwYy00N2UzLWFjYjMtMTBiN2QwYmNlODE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE4NTcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5YjkxOWE0Y2RkNjQ3MDRhZDc1Y2FjOWE4OWE0MzkwOTk1ZDRjODQxNjY1ZGE1MmI0YmM0YjQzMTMwZDBhYjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Lyq0HCd7qwseGXIj8PNgVIQAVAl7pcQCbm2aVcR6L5A)
Import the AR Background Video Enhancement
package sample for how to use this feature. Please note that not all iOS devices support 4K or HDR. For more information, please visit the ARKit's website and check out this WWDC session on ARKit 6.
If you encounter any issues, have queries, suggestions, or discover any bugs, we welcome you to join our Discord community or submit an issue. Your feedback is invaluable as we continually strive to update and improve the HoloKit Unity SDK.