> For the complete documentation index, see [llms.txt](https://jorge-jgnz94.gitbook.io/hptk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jorge-jgnz94.gitbook.io/hptk/getting-started.md).

# Getting started

## Getting started with HPTK (Oculus Quest)

### 1. Obtain HPTK

In Unity Editor, open *Package Manager*. Click on *Add package from git URL* and paste the following URL:

```
  https://github.com/jorgejgnz/HPTK.git
```

Click on *Add* and Unity will download the UPM package. This package has no dependencies.

### 2. Import Oculus Integration

Download [Oculus Integration 20.1](https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022) from Asset Store or the [Oculus Archive](https://developer.oculus.com/downloads/package/unity-integration/) and import it.

```
  Oculus Integration is a dependency for the InputDataProvider OVRSkeletonTracker, which reads hand data from OVRHand and OVRSkeleton components.
  OVRSkeletonTracker is not included in the HPTK package. We will download it in following steps.
```

### 3. Build Settings (Oculus Quest)

* Switch platfrom to *Android*.
* Set *Texture compression* to *ASTC*.

This may take a while, you can take a break 😊

[![Buy Me A Coffee](https://camo.githubusercontent.com/c3f856bacd5b09669157ed4774f80fb9d8622dd45ce8fdf2990d3552db99bd27/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.buymeacoffee.com/jorgejgnz)

### 4. Project Settings (!)

HPTK relies on nVidia PhysX and Unity's built-in Configurable Joints to simulate hand physics. HPTK has been tested under the following recommended settings:

Physics:

* Default Solver Iterations: 50.
* Default Solver Velocity Iterations: 25.
* Enable Adaptative Force: *enabled*
* Friction Type: *Two Directional Friction Type*.
* Solver Type: *Temporal Gauss Seidel*.
* Default values for other variables.

Time:

* Fixed Timestep: 0.01.

Player/Other (Oculus Quest):

* Scripting backend: *ILCPP*.
* Target architecture: *ARM64*.
* Graphic APIs: Remove *Vulkan* (only *OpenGLES3*).

The following table shows a comparison of how this configuration affects the realism of the simulation:

| ![](https://camo.githubusercontent.com/2cac077f9374fa486b8d1d77c5171625624d8229e9d56a74c7783c0e75cdf9fe/68747470733a2f2f692e696d6775722e636f6d2f5338314f6b77752e676966) | ![](https://camo.githubusercontent.com/cbdf17722680da6dfff69600b417784cf745ed13f9c4ec66038ec9645b9ea1e7/68747470733a2f2f692e696d6775722e636f6d2f5674734f33424d2e676966) |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Default                                                                                                                                                                 | Configured                                                                                                                                                              |

### 5. Setup a scene with hand tracking support (Oculus Quest)

* Install XR Plugin Management. Add *Oculus* in *Plug-in Providers*.
* Set *Stereo Rendering Mode (Android)* to *Multiview*.

{% hint style="info" %}
The built-in URP shader will not work in the default Oculus stereo rendering mode (PC): *Single Pass Instanced*. If you want to use this shader and you're experiencing **rendering issues**, please check that you are targeting to Android platform and that you are using *Multiview* as Oculus stereo rendering mode (Android).
{% endhint %}

* Delete any *MainCamera* in scene. Add *OVRCameraRig* prefab.
* Add *OVRHandPrefabs* for each hand as **children** of *LeftHandAnchor* and *RightHandAnchor* (children of *OVRCameraRig* object).
* Set *Hand Tracking Support* (*OVRManager* component in *OVRCameraRig* object) to *Controllers And Hands*.
* Set *Hand Type* & *Skeleton Type* for *OVRHand* & *OVRSkeleton* components.
* Disable components *OVRSkeletonRender, OVRMesh, OVRMeshRenderer & SkinnedMeshRenderer* for every *OVRHandPrefab*.

### 6. Setup HPTK specific components

* Add *SpAvatar+Dummy* prefab to the Scene (make sure that *SpAvatar* is close to *OVRCameraRig*).
* Add *HPTKCore* prefab to the Scene. Drag & drop *CenterEyeAnchor* (child of *OVRCameraRig*) into *TrackedCamera* field in *CoreModel* component (*HPTKCore*).

### 7. Setup platform specific HPTK components (Oculus Quest)

* Download [OVRSkeletonTracker.cs](https://github.com/jorgejgnz/HPTK-Sample/blob/master/Assets/HPTK-Sample/Scripts/Input/OVRSkeletonTracker.cs). Store it in *Assets/(YourCustomFolder)/Scripts/Input/*.
* Add 2 empty gameobjects as children of *SpAvatar>InputDataProviders* in the scene. Rename them to *OVRSkeletonTracker.L* and *OVRSkeletonTracker.R*.
* Add a OVRSkeletonTracker component to each of them.
* Set *Hand Data* and *Bone Data* fields for each *OVRSkeletonTracker* component with their corresponding *OVRHandPrefabs*.
* Set *OVRSkeletonTracker.x* as Input Data Provider in *SpAvatar>ProxyHand.X>\[Modules]>Input.X>InputModel.X* (InputModel component).

### 8. HPTK Configuration Assets

HPTK includes different configuration assets which default values have already been fine-tuned for a generic purpose. If you need more sensible gesture detection or different hand physics configurations, you can modify the following configuration assets:

* CoreConfiguration.
* HandPhysicsConfiguration.

  ```
  You can create new configuration assets by doing right-click on the Project window in the Unity Editor. Then go to Create/HPTK/*.
  To use these assets, drag & drop them in any CoreModel or HandPhysicsModel component.
  ```
