# Data Model

## Overview

**The data model that describes an avatar is the Model of the Avatar module**. From this Model (or its View) you can navigate through the avatar and reach the references, registered modules or variables you need.

Here's the definition of the concepts that will refer to the different components of an avatar:

* **Avatar:** Group of bodies controlled by the same user.
* **Body:** Tree structure of parts and bones.
* **Part:** Section of a body. Can contain parts and bones.
* **Bone:** Terminal section of a part. Contain points. Slave will have a Rigidbody per bone.
* **Point:** Abstract representation of a point in space.
* **Representation:** Actual representation of a point.

## Relations

In a nutshell:

* **An avatar can have multiple bodies.**
  * Having just one body is most common use case.
* **A body is composed of a tree of parts.**
  * A body have (1,1) root part.
* **A part can have (0,n) child parts and (1,n) bones.**
  * An arm (part) have two bones (upper arm and forearm) and a hand (child part).
  * A hand (part) have one bone (wrist) and 5 fingers (child parts), each of them composed of 3 or 4 bones and 0 child parts.
* **A bone have (1,n) points.**
  * Most bones have only one point but, for isntance, wrist bone contains the wrist point and also some other important palm points like interior, exterior, center and normal.
* **A point have (1,n) representations.**
  * A representation is a link between a point and a Transform that is identified by a name. If we use physics we will have "master" and "slave" (puppet) representations.
  * In order to prevent hard-coding keys, `AvatarModel.key` and `PuppetModel.key` store the keys for the master and slave representations respectively.

![Detailed view of the components of an avatar](https://2698598769-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MYpeL-Cll-FXMj9b3XC%2F-MgfpETv7c1w0UmagNNG%2F-Mgfq9y0r1VUQEvWcgxJ%2Favatar_data_model.png?alt=media\&token=8ed95e4a-4dec-4c19-8b40-2e9720c5eb3f)
