> 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/custom-rigged-hands.md).

# Custom rigged hands

## How to set up custom rigged hands

HPTK supports other rigged hands apart from the included ones (from Oculus Package). However, custom rigged hand models have to fulfill some requirements in order to be compatible with HPTK and its modules. HPTK package includes a component called **AutomaticHandSetup** to generate valid HPTK proxy hands from arbitrary hand armatures that fits the following certain requirements that are specified in the following section.

### Requirements

* Wrist and bone local rotations match world axis when these local rotations are set to 0 (Quaternion.identity).
* Each finger is required to have a leaf bone that will be considered as finger tip.
* At least two fingers are required (index and thumb). This makes grabbing possible.
* For *Automatic Hand Setup* script to work properly, hand armature is required to follow a defined structure (see **Armature** section).

The following pictures shows expected axis for wrist and bones. Wrists are not rotated or scaled.

| ![](https://camo.githubusercontent.com/bb3f896b173d421c45735175c2cdc44c214b14490424e4306d3f18a2c3530cdf/68747470733a2f2f692e696d6775722e636f6d2f506362777143442e706e67) | ![](https://camo.githubusercontent.com/3e67064ff77de89155cac7c975630bba6f9ebe9d1812c07f5cfb40a8cf5e5f8c/68747470733a2f2f692e696d6775722e636f6d2f433744435047382e706e67) |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Included hand armature (Oculus)                                                                                                                                         | Simplified hand armature                                                                                                                                                |

### Recommendations for hand tracking

If Input module will be used and its InputDataProvider will get hand data from hand tracking, the following points are highly recomendable:

* If InputModel's InputDataProvider is getting data from hand tracking, real wrist might not match model's wrist and this can break self-perception and, therefore, breaking immersion. Therefore, set *Generate Master Offset* to *true* on **AutomaticHandSetup**\*. This will generate a new object that is children of master wrist and parent of master fingers. HandPhysicsController will make slave wrist to match master offset (if existing).
* Scale hands to match the size of your users's hands before generating. Make sure that local scale equals *Vector3.one* for original armature bones.

### Armature

The following pictures shows the expected hierarchy for hand armatures to be parsed by *Automatic Hand Setup* component. Armatures with less fingers (at least index and thumb) and less phalanges (at least 1 bone and its fingerTip) are also valid for *Automatic Hand Setup*.

Input module will move wrist. HandPhysics module will make slave's wrist to reach master's wrist (or master's wrist offset if existing).

![Armature hierarchy](https://camo.githubusercontent.com/25fa91009a08b19f2e2cc07478ab0f9130e8996bfe29e34a26d277a63db4528b/68747470733a2f2f692e696d6775722e636f6d2f594c714a64455a2e706e67)

### Automatic Hand Setup

HPTK package contains a script to set up all needed from a basic hand armature. This script will create different hand representations with their points, triggers, colliders, ConfigurableJoints, rays and data models (ProxyHandModel, HandModels, FingerModels and BoneModels). This script is a Unity component that you can attach anywhere in the scene. Following points describe some of its parameters:

* **Finger radius:** Radius of the capsule colliders that will be generated for each bone. These colliders can be edited after generation if fine tuning is necessary.
* **Index and Thumb root bones:** First transforms of thumb and index fingers. They are required to be children of wrist (or wrist offset if it's used).
* **ProxyHandModule:** HPTK module prefab that will be instantiated in the generated hand. Included in the HPTK package.
* **Default palm mesh:** If there is no specific mesh for palms available, using a Cylinder primitive is highly recommended.
* **Skin physic material:** Physical material that will be applied to generated colliders.
* **Generate armature anchors:** Original armature will be modified to include anchors which are empty gameobjects placed on each armature bone but preserving valid home rotations (world axis). These anchors can be set only as children of pre-existing bones or as parent. This operation will throw exceptions if applied on armature prefabs. In that case, unpack prefab first.
* **Use original armature as:** Use original armature bones as master or slave bones. If don't expect to use hand physics, use them as master. If you expect to use hand physics, use them as slave. If you don't want to modify the original armature, set this option to None.
* Children of wrist (or wrist offset if it's used) with child count >0 will be considered as fingers and the children of these fingers can only have one single child recursively (clean branch).
* Generated HandModels will only contain references to FingerModels for Index and Thumb. Other detected fingers will have their generated FingerModels but the references to these FingerModels have to be added in each HandModel manually.
* Master, slave and ghost hands will be generated. If slave or ghost hand representations are not needed, they can be deleted.

{% hint style="info" %}
HandModels, FingerModels and BoneModels are also generated as children of ProxyHandModel. If a hand representation is removed, its model has to be removed too.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jorge-jgnz94.gitbook.io/hptk/custom-rigged-hands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
