Skip to main content
Version: 3.4

How to Set Up and Run Lightship Simulation

Lightship Simulation allows you to test your AR content in-editor without having to use Unity's playback mode. Our simulation mode allows you to move freely around a virtual 3D space while testing out your AR features in real time.

Prerequisites

You will need a Unity project with ARDK 3.4 installed and a basic AR scene. For more information, see Installing ARDK 3 and Setting up an AR Scene.

Enabling Lightship Simulation

Lightship Simulation comes prepackaged with ARDK 3.4. To enable Lightship Simulation in your Unity project:

  1. In the Lightship top menu, select XR Plug-in Management, then check the box labeled Niantic Lightship Simulation.

    Selecting Niantic Lightship Simulation in XR Plugin Management

Creating and Setting a SimulationEnvironment

Before running your simulation, you will need to turn a prefab into a SimulationEnvironment that the system can navigate. To create and set a SimulationEnvironment:

  1. Open or create the prefab you would like to use as your SimulationEnvironment.
  2. In the Inspector, click Add Component and add a Simulation Environment component to the prefab.
  3. In the Simulation Environment Component, set the Camera Starting Pose (Position) to 0, 0, 0 and the Camera Movement Bounds (Extents) to a value large enough to encompass the entire simulation, such as 1000, 1000, 1000.
  4. Set the environment in Lightship Settings:
  5. Open the Lightship top menu, then select Settings. Scroll down to Lightship Simulation Settings, then drag your SimulationEnvironment prefab from the Project Window to the field labeled Environment Prefab. (You can also click the small circle button to the right of the text field and select your environment prefab from the list.)
  6. Set the environment again in Unity:
  7. Open the Window top menu, then select XR > AR Foundation > XR Environment. The XR Environment window will open.
  8. Click the drop-down menu, then select your environment prefab from the list to assign it in Unity.Selecting an environment in Unity
note

Without a simulation environment set, Unity will default to a basic environment. If you load your simulation and find yourself in the default, make sure the camera values are properly set and that there is no type mismatch.

Lightship Simulation Settings

To change the Lightship simulation settings, open the Lightship top menu, then select Settings. The simulation settings are at the bottom of the Lightship Settings menu.

The simulation settings are as follows:

  • Environment Prefab - This option provides a place to set the environment prefab.
  • Use Lightship Depth - Check this option to use Lightship's depth algorithm instead of Unity's.
  • Use Lightship Persistent Anchors - Leave this option unchecked to use Simulation VPS. Enabling this option will run real VPS on simulated environments. Leaving this option unchecked will enable additional options for configuring Simulation VPS:
    • Minimum/Maximum Anchor Discovery Time Seconds - Sets the minimum and maximum time (in seconds) that must pass before the anchor is surfaced.
    • Apply Translational Offset - Enabling this offsets the position of the anchor when it is surfaced by a random amount between 0 and the Offset Severity.
    • Translational Offset Severity Meters - Specifies the maximum distance (in meters) that the anchor can be offset.
    • Apply Rotational Offset - Enabling this offsets the rotation of the anchor when it is surfaced by a random amount between 0 and the Offset Severity.
    • Rotational Offset Severity Degrees - Specifies the maximum rotation (in degrees) of the anchor offset.
    • Surface Anchor Failure - Enabling this allows you to test a failed anchor instead of a successful one.
    • Tracking State Reason - Specifies which kind of failed anchor to test.

Running and Using the Simulation

Once you have loaded the simulation environment, press Play. Lightship will load the environment into a new scene called Simulated Environment Scene on Layer 30, then start the simulation.

The Simulated Environment Scene appearing in the Hierarchy

To unlock movement in the simulation, hold down the right mouse button (or tap and hold with two fingers on trackpad) in the game view, then use these controls to move around:

  • WASD keys to move forward/backward and strafe;
  • Move the mouse to rotate the view;
  • Q and E keys to move up and down;
  • Shift to go faster.