Walkabout: Gameboard
Demonstrates the Gameboard ARDK feature, which leverages AR meshing for virtual character placement and navigation.
Overview
After some instructions, the app turns on the device’s camera and the player is prompted to scan their surroundings, enabling the app to discover and create a navigable Gameboard on the ground. If the device has LIDAR, the resulting Gameboard may be more refined and stable.
Once enough Gameboard tiles are created, a camera-controlled reticle appears on / next to the Gameboard, allowing the player to move around a translucent Captain Doty yeti. The reticle is green when on a safe/valid place to put Doty; otherwise the reticle is orange. A button appears near the bottom of the screen; pressing it solidifies Doty and places the them at their current location, with a small snowball.
Small snow piles appear distributed about the Gameboard, that Doty can collect to grow their snowball. The player is prompted to aim the reticle to choose a destination for Doty to walk to, and press the placement button; an X is placed at the chosen location. (Some margin from the edge of the Gameboard is required, to give Doty enough clearance to turn.)
As Doty rolls their snowball, if they intersect a snow pile, the pile is collected and the snowball grows in size. Once the snowball is large enough, the bottom half of a snowman appears somewhere nearby. The player completes the scene by navigating Doty to the snowman to complete it.
ARDK Features in use
ARSceneManager
ARMeshManager
- Manages detection of the AR environment mesh, including instantiation and destruction of MeshCollliderChunk geometry objects that align with the detected meshGameboard
- Provides functionality to scan the AR environment mesh and maintain a set of tiles indicating the walkable portions of the mesh. The Gameboard also provides path planning logic that calculates a path for the character to use when moving from point to point across the tiles. The Gameboard is dynamically updated during gameplay. New tiles may appear if new environment geometry is discovered, and existing tiles may disappear if parts of the room become newly occluded by people, pets, etc., or if lighting conditions change that affect the meshing process. If a piece of Gameboard disappears underneath Doty’s feet, Doty may be teleported to the closest valid point on the remaining Gameboard.ARDepthManager
- for occlusion via depthARSemanticSegmentationManager
- for attempting to mask out occlusion of items on the “ground” category/segmentation
Additional Custom Helpers
GameboardHelper
- helper functionality for working with the ARDK GameboardWalkaboutDebugManager
- manages the debug functionality for the scene
States
StateInstructions
A UI displaying instructions.
StateWarning
A UI displaying a warning about using AR; this is only displayed once per execution of the app, before the user enters an ARSession for the first time.
StateScanning
The device’s camera is turned on, and the player is prompted to scan their surroundings, enabling the app to fill the ground with a navigable Gameboard surface. If the device has LIDAR, the resulting Gameboard may be more refined and stable.
StatePlacement
A camera-controlled reticle appears on / next to the Gameboard, allowing the player to move around a translucent Captain Doty yeti. The reticle is green when on a safe/valid place to put Doty; otherwise the reticle is orange.
StateGrowSnowball
The player chooses destinations for Doty to walk to, in order to collect snow piles to grow their snowball.
StateBuildSnowman
Once the snowball is large enough, the bottom half of a snowman appears somewhere nearby. The player completes the scene by navigating Doty to the snowman to complete it.
StateGameOver
UI displaying the player’s final step count, and an option to Restart, or Return to Map.
Editor-Only Mock Support
When developing ARDK applications in editor, to avoid always requiring building to a device, it is convenient to employ mock versions of AR assets that function in Unity Editor. Each scene’s mock objects are attached to the scene’s MockScene GameObject. This object has a MockSceneConfiguration component that will destroy the object if outside of Unity Editor.
This scene’s MockScene object includes:
A mock environment mesh that is activated by the MockScene object in Unity Editor only.