How yubeenpark/placesound works
Project type and purpose
• This is a Unity-based mobile AR (Augmented Reality) application (“placesound”) for Android.
File structure
• Top-level scripts: ARFeatheredPlaneMeshVisualizer, ArScenceManger, FadePlaneOnBoundaryChange – these hook into Unity’s AR Foundation to detect and render planes.
• managers/: orchestrates high-level behaviors (ARmanager, UIManager, SceneManger, CloudAnchorSessionManager, AzureAnchor, saveModel).
• SpatialAnchor/: demos and base classes for placing anchors, handling input, and tying into Azure Spatial Anchors.
• File/SaveData, SaveObject/: local persistence of placed objects and their transforms.
• Music/: UI and code for selecting, playing, and adjusting 3D spatial audio.
• Utility/: enums and helper methods (serialization, touch extensions, scenery utilities).
Key insights from README
• Technologies: Unity3D, ARCore, XR Foundation, Azure Spatial Anchors, C#.
• Runtime flow: user selects model → selects sound → taps to anchor in real world → sound plays/attenuates based on distance → user can save/load scenes.
Components
• AR Foundation / ARCore subsystem
• Azure Spatial Anchors client (CloudAnchorSessionManager, AzureAnchor)
• Scene & UI managers (SceneManger, UIManager, AppStateManagers)
• Audio subsystem (NativeMusic, MusicButton, SliderB, AddToList)
• Persistence (SaveDataManager, SaveModelManager, local file I/O)
• Utility layer (SceneryUtil, SerialiseTransformUtil, TouchExtension)
b. External services
• Azure Spatial Anchors service (cloud database of anchor IDs and transforms)
c. Device sensors & platform
• Mobile camera & IMU (via ARCore)
• Local file system on device
d. Data flows / interactions
1. App initializes AR Session → AR Foundation communicates with device sensors.
2. User taps screen → TouchExtension → PlaceObjectPlane / InputInteractionBase → SceneManger → ARmanager creates or finds anchor.
3. If “Save” → CloudAnchorSessionManager sends anchor to Azure → receives cloud anchor ID → SaveModelManager & SaveDataManager serialize transform & metadata to local or remote store.
4. On load → Data read from local file (ReadFile) → anchors rehydrated via Azure → ARmanager re-instantiates models.
5. Audio subsystem tracks each model’s transform → NativeMusic / AudioSource plays 3D sound → volume attenuation based on distance computed in code (e.g., TransformComponentDTO, SceneryUtil).
Architectural patterns & design principles
• Modular managers: each responsibility (AR, UI, Audio, Persistence) is isolated behind a manager class.
• Dependency inversion: high-level controllers (SceneManger, UIManager) interact with abstracted services (CloudAnchorSessionManager, SaveDataManager).
• Event-driven user interactions: InputInteractionBase / DemoScriptBase patterns.
• Serialization layer separating DTOs (TransformComponentDTO) from Unity components.
Detail without overcomplication
• Managers and utility layers that play a role in the runtime flow.
• Both local file persistence and cloud persistence paths.
• 3D audio computation as a feedback loop driven by model transforms.