6.2 KiB
6.2 KiB
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
- Interaction Component: Handles interaction logic
- Prompt Component: Shows interaction prompts
- 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
- Open/Close: Animate door open/close
- Lock System: Lock/unlock functionality
- Audio: Play door sounds
- 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
- Display: Show hologram content
- Material: Use hologram material
- Animation: Animate hologram
- 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
- Display UI: Show info panel UI
- Content: Display information
- Close: Close panel on interaction
- 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
- Floor Selection: Show floor selection UI
- Movement: Animate elevator movement
- Audio: Elevator sounds
- 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
- Interaction: Player interacts with teleport point
- Confirmation: Show confirmation UI
- Teleport: Teleport player to destination
- Effect: Play teleport effect
Player Controller
BP_PlayerController
Player controller for interactions
Components
- Interaction Component: Handles interaction input
- Camera Component: Player camera
- 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
- Prompt Text: "Press E to interact"
- Icon: Interaction icon
- 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
- Detection: System detects player near interactable
- Prompt: Show interaction prompt
- Input: Player presses interact button
- Interaction: Execute interaction
- Feedback: Provide feedback (audio, visual)
Implementation
- Overlap Detection: Use overlap events
- Raycast Detection: Use raycast for precise detection
- Distance Check: Check distance to interactable
- Priority: Handle multiple interactables (nearest first)
Quest Integration
Quest System
Optional quest system integration
Implementation
- Quest Triggers: Interactions trigger quest events
- Quest Objectives: Interactions complete objectives
- 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
- Audio Components: Attach to interactables
- Sound Cues: Create sound cues
- Playback: Play sounds on interaction
Performance Optimization
Interaction Optimization
- Update Frequency: Optimize interaction checks
- Distance Culling: Only check nearby interactables
- Caching: Cache interaction results
Testing
Interaction Testing
- Functionality: Test all interaction types
- UI: Test interaction UI
- Audio: Test interaction audio
- 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]