# HandVisual

```csharp
public class HandVisual : MonoBehaviour
```

Inherits [UnityEngine.MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) class.

### Constructors

| Name         | Description                      |
| ------------ | -------------------------------- |
| HandVisual() | Creates a new HandVisual object. |

### Properties

| Name   | Type                                                                         | Description                               |
| ------ | ---------------------------------------------------------------------------- | ----------------------------------------- |
| Hand   | [Hand](https://handtracking.lightbuzz.com/api-reference/hand)                | The hand associated with the visual.      |
| Offset | [UnityEngine.Vector3](https://docs.unity3d.com/ScriptReference/Vector3.html) | The offset associated with the visual.    |
| Is2D   | bool                                                                         | Whether it shows the 2D or 3D positions.  |
| Image  | [ImageView](https://handtracking.lightbuzz.com/ui-reference/imageview)       | The ImageView associated with the visual. |

### Methods

| Name                                                                                                                                             | Return Type | Description                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Load([Hand](https://handtracking.lightbuzz.com/api-reference/hand),[UnityEngine.Vector3](https://docs.unity3d.com/ScriptReference/Vector3.html)) | void        | Visualizes the hand using `LineRenderer` objects. If an optional offset parameter is provided, it relocates the hand's position in 3D by the specified offset value. The offset is measured in meters. |
| Toggle(bool)                                                                                                                                     | void        | Sets `LineRenderer` objects to visible when set to `true`.                                                                                                                                             |

### Example

The example shows how to visualize a detected hand with the `HandVisual` class.

To visualize a hand, first, you need to instantiate a `GameObject` and get the component `HandVisual`. Then load the detected `Hand` to the specified `ImageView.`

```csharp
// Assign the prefab in the Editor.
[SerializeField] private GameObject _handPrefab;

// Instatiate GameObject.
GameObject handObject = Instantiate(_handPrefab, transform);

// Get HandVisual component.
HandVisual handVisual = handObject.GetComponent<HandVisual>();

// Visualize hand.
handVisual.Load(hand);
```
