# ahmedawwan/unity-human-anatomy-ar architecture

> Architecture diagram of the GitHub repository ahmedawwan/unity-human-anatomy-ar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmedawwan/unity-human-anatomy-ar
- Repository: https://github.com/ahmedawwan/unity-human-anatomy-ar

## Overview

##### Main Components
- AR Module: This includes the camera feed, surface detection algorithms, and placement logic. Capture the process where after authentication, the camera activates and the system uses ARCore (and possibly Unity’s AR subsystems) to detect surfaces and show a crosshair/indicator.
- Object Augmentation Module: Responsible for handling the selection of 3D human anatomy models (located in the Models folder) and their instantiation in the AR scene. It covers the logic that takes user input (via custom scroll views, prefabs, and related UI scripts) to place and render selected objects at the crosshair’s location.
- Interaction/Transformation Module: Manages touch gestures for scaling, rotating, and moving the augmented object. This can involve inputManager.cs, zoomManager.cs, and other transformation-related scripts.
- UI and Experience Module: Contains components such as custom scroll views, label displays, and information panels. Look into folders like “Clean Settings UI”, “MarkLight”, and “TextMesh Pro” which are used for building and styling the UI.
- Authentication Module: Integrates Firebase for user authentication. The presence of Scripts like authenticationManager.cs and Firebase-related assets in the Plugins and Data directories show that login and user management are handled via Firebase.
- Asset Management and Resources: This component covers the handling of 3D models, textures, materials, animation controllers, and any external plugins (such as DOTween) used to enhance dynamic behavior and transitions.

##### Out the Relationships and Interactions
- The user (mobile device) initiates the application and is first routed to an authentication screen which uses Firebase.
- Once authenticated, the AR Module activates the camera and runs surface detection, with the system placing a crosshair indicating valid surfaces.
- The UI Module then allows the user to scroll through and select an anatomy model. When a selection is made, the Object Augmentation Module instantiates the model at the crosshair’s position.
- The Interaction Module manages touch gestures. Data flows from input managers to adjust the object’s position, scale, and rotation.
- If the viewer centers their view on an object, the UI Module (along with label/viewer scripts) displays extra information about anatomical parts.

##### Architectural Patterns and Principles
- Component-Based Architecture: Being a Unity project, each functionality is likely encapsulated in separate components and prefabs (e.g., separate scripts for handling UI, animations, interactions, etc.).
- Separation of Concerns: Notice the clear division between AR functionality, UI handling, authentication, and asset management.
- Modularity and Extensibility: The rich directory structure (e.g., MarkLight for UI, DOTween for animations, Firebase integration) suggests a design where modules can be maintained and extended independently.

##### Relevant Technologies and Frameworks
- Unity Game Engine as the core platform.
- ARCore and XR Interaction Toolkit for AR and XR services.
- Firebase for authentication.
- DOTween for animations.
- MarkLight and TextMesh Pro for UI layout and text rendering.

## Diagram (Mermaid)

```mermaid
graph TD
    A["User/Device"]:::user

    subgraph "Service Layer"
        B["Authentication (Firebase)"]:::auth
        B1["Authentication Manager"]:::auth
        B2["Firebase Assets/Config"]:::auth
        B3["Firebase Plugins"]:::auth
        B --> B1
        B --> B2
        B --> B3

        C["Asset Management & Resources"]:::asset
        C1["Addressable Assets"]:::asset
        C2["Resources"]:::asset
        C3["Materials"]:::asset
        C4["Textures"]:::asset
        C --> C1
        C --> C2
        C --> C3
        C --> C4
    end

    subgraph "Presentation Layer"
        D["AR Camera Feed & Surface Detection"]:::ar
        D1["AR Core Loader"]:::ar
        D2["AR Core Settings"]:::ar
        D3["Crosshair Placement"]:::ar
        D --> D1
        D --> D2
        D1 --> D3
        D2 --> D3

        E["UI Module (Scroll & Labels)"]:::ui
        E1["Clean Settings UI"]:::ui
        E2["MarkLight"]:::ui
        E3["TextMesh Pro"]:::ui
        E --> E1
        E --> E2
        E --> E3
    end

    subgraph "Application Layer"
        F["3D Model Selection & Instantiation"]:::obj
        F1["3D Models"]:::obj
        F2["Prefabs"]:::obj
        F --> F1
        F --> F2

        G["Interaction/Transformation"]:::inter
        G1["Input Manager"]:::inter
        G2["Zoom Manager"]:::inter
        G --> G1
        G --> G2
    end

    subgraph "External Dependencies"
        H["ARCore"]:::external
        I["Firebase"]:::external
        J["DOTween"]:::external
    end

    %% Connections
    A -->|"authenticates"| B
    A -->|"initiates"| D
    A -->|"touch input"| G

    B -->|"onSuccess"| D

    D3 -->|"triggers instantiation"| F
    E -->|"model selection"| F
    G -->|"modifies"| F
    F -->|"updates"| E

    C1 --> F
    C2 --> F
    C3 --> F
    C4 --> F

    H --> D1
    H --> D2
    I --> B
    J --> G

    %% Styles
    classDef user fill:#f9e79f,stroke:#333,stroke-width:2px
    classDef auth fill:#fadbd8,stroke:#333,stroke-width:2px
    classDef ar fill:#d5f5e3,stroke:#333,stroke-width:2px
    classDef ui fill:#d6eaf8,stroke:#333,stroke-width:2px
    classDef obj fill:#e8daef,stroke:#333,stroke-width:2px
    classDef inter fill:#fcf3cf,stroke:#333,stroke-width:2px
    classDef asset fill:#e8f8f5,stroke:#333,stroke-width:2px
    classDef external fill:#f5b7b1,stroke:#333,stroke-width:2px

    %% Click Events
    click D1 "https://github.com/ahmedawwan/unity-human-anatomy-ar/blob/main/Assets/XR/Loaders/AR Core Loader.asset"
    click D2 "https://github.com/ahmedawwan/unity-human-anatomy-ar/blob/main/Assets/XR/Settings/AR Core Settings.asset"
    click F1 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Models"
    click F2 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Prefabs"
    click G1 "https://github.com/ahmedawwan/unity-human-anatomy-ar/blob/main/Assets/Scripts/inputManager.cs"
    click G2 "https://github.com/ahmedawwan/unity-human-anatomy-ar/blob/main/Assets/Scripts/zoomManager.cs"
    click E1 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Clean Settings UI"
    click E2 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/MarkLight"
    click E3 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/TextMesh Pro"
    click B1 "https://github.com/ahmedawwan/unity-human-anatomy-ar/blob/main/Assets/Scripts/authenticationManager.cs"
    click B2 "https://github.com/ahmedawwan/unity-human-anatomy-ar/blob/main/Assets/Data/google-services.json"
    click B3 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Plugins"
    click C1 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/AddressableAssetsData"
    click C2 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Resources"
    click C3 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Materials"
    click C4 "https://github.com/ahmedawwan/unity-human-anatomy-ar/tree/main/Assets/Textures"
```
