# Interaction System - Dubai Metaverse ## Overview This document describes the interaction system framework for player interactions with the environment in the Dubai Metaverse project. ## System Architecture ### Base Framework #### BP_Interactable **Base class for all interactable objects** ### Components 1. **Interaction Component**: Handles interaction logic 2. **Prompt Component**: Shows interaction prompts 3. **Audio Component**: Interaction sounds (optional) ### Functions #### OnInteract - **Purpose**: Called when player interacts - **Implementation**: Override in child classes - **Parameters**: Interacting player #### ShowPrompt - **Purpose**: Show interaction prompt - **Implementation**: Display UI prompt - **Parameters**: Prompt text #### HidePrompt - **Purpose**: Hide interaction prompt - **Implementation**: Hide UI prompt --- ## Interaction Types ### Doors #### BP_Door **Automatic or manual doors** ### Properties - **Door Type**: Automatic, manual, locked - **Animation**: Open/close animation - **Sound**: Door open/close sound - **Lock State**: Locked/unlocked ### Implementation 1. **Open/Close**: Animate door open/close 2. **Lock System**: Lock/unlock functionality 3. **Audio**: Play door sounds 4. **State**: Track door state --- ### Holograms #### BP_Hologram **Holographic displays** ### Properties - **Content**: Hologram content (text, image, video) - **Material**: Hologram material (emissive, translucent) - **Animation**: Hologram animation - **Interaction**: Interaction type (display, activate) ### Implementation 1. **Display**: Show hologram content 2. **Material**: Use hologram material 3. **Animation**: Animate hologram 4. **Interaction**: Handle player interaction --- ### Info Panels #### BP_InfoPanel **Information display panels** ### Properties - **Content**: Information content (text, images) - **UI Widget**: Info panel UI widget - **Display Time**: How long to display - **Close Method**: How to close (button, timer) ### Implementation 1. **Display UI**: Show info panel UI 2. **Content**: Display information 3. **Close**: Close panel on interaction 4. **Audio**: Optional audio narration --- ### Elevators #### BP_Elevator **Elevator stub interactions** ### Properties - **Floors**: Available floors - **Current Floor**: Current floor - **Animation**: Elevator movement animation - **UI**: Floor selection UI ### Implementation 1. **Floor Selection**: Show floor selection UI 2. **Movement**: Animate elevator movement 3. **Audio**: Elevator sounds 4. **State**: Track elevator state --- ### Teleport Points #### BP_TeleportPoint **Fast travel/teleport system** ### Properties - **Destination**: Teleport destination - **Name**: Teleport point name - **UI**: Teleport confirmation UI - **Animation**: Teleport effect ### Implementation 1. **Interaction**: Player interacts with teleport point 2. **Confirmation**: Show confirmation UI 3. **Teleport**: Teleport player to destination 4. **Effect**: Play teleport effect --- ## Player Controller ### BP_PlayerController **Player controller for interactions** ### Components 1. **Interaction Component**: Handles interaction input 2. **Camera Component**: Player camera 3. **Movement Component**: Player movement ### Input Mapping - **Interact**: E key / Gamepad button - **Cancel**: ESC key / Gamepad button ### Functions #### CheckInteractables - **Purpose**: Check for nearby interactables - **Implementation**: Raycast or overlap check - **Output**: Nearest interactable #### Interact - **Purpose**: Interact with object - **Implementation**: Call interactable's OnInteract - **Parameters**: Interactable reference --- ## UI System ### WBP_InteractionPrompt **Interaction prompt widget** ### Elements 1. **Prompt Text**: "Press E to interact" 2. **Icon**: Interaction icon 3. **Object Name**: Interactable object name ### Display - **Position**: Screen position (center or bottom) - **Visibility**: Show when near interactable - **Animation**: Fade in/out animation --- ## Interaction Flow ### Player Approach 1. **Detection**: System detects player near interactable 2. **Prompt**: Show interaction prompt 3. **Input**: Player presses interact button 4. **Interaction**: Execute interaction 5. **Feedback**: Provide feedback (audio, visual) ### Implementation 1. **Overlap Detection**: Use overlap events 2. **Raycast Detection**: Use raycast for precise detection 3. **Distance Check**: Check distance to interactable 4. **Priority**: Handle multiple interactables (nearest first) --- ## Quest Integration ### Quest System **Optional quest system integration** ### Implementation 1. **Quest Triggers**: Interactions trigger quest events 2. **Quest Objectives**: Interactions complete objectives 3. **Quest Dialogue**: Interactions provide quest information --- ## Audio Integration ### Interaction Sounds - **Interaction Start**: Sound when interaction starts - **Interaction Complete**: Sound when interaction completes - **Error**: Sound for invalid interactions ### Implementation 1. **Audio Components**: Attach to interactables 2. **Sound Cues**: Create sound cues 3. **Playback**: Play sounds on interaction --- ## Performance Optimization ### Interaction Optimization 1. **Update Frequency**: Optimize interaction checks 2. **Distance Culling**: Only check nearby interactables 3. **Caching**: Cache interaction results --- ## Testing ### Interaction Testing 1. **Functionality**: Test all interaction types 2. **UI**: Test interaction UI 3. **Audio**: Test interaction audio 4. **Performance**: Test performance impact --- ## Troubleshooting ### Common Issues **Issue**: Interactions not working - **Solution**: Check interaction component setup - **Solution**: Verify input mapping **Issue**: Prompt not showing - **Solution**: Check prompt component - **Solution**: Verify UI widget setup **Issue**: Multiple interactables - **Solution**: Implement priority system - **Solution**: Show nearest interactable --- ## Documentation ### Interaction Documentation Document each interaction type: - **Purpose**: What the interaction does - **Implementation**: How it's implemented - **Usage**: How to use it - **Parameters**: Configurable parameters --- **Version**: 1.0 **Last Updated**: [Current Date]