class ARScanManager (Niantic.ARDK.Extensions.Scanning.ARScanManager)

Overview

The ARScanManager can be placed in a scene to easily manage scanning, visualization, and reconstruction. More...

class ARScanManager: Niantic.ARDK.Extensions.ARSessionListener {
public:
    // fields

    float maxScanDistance = 5f;
    ReconstructionOptions.Quality meshQuality;
    ReconstructionOptions.ReconstructionMode reconstructionMode;
    bool recordLocation = true;
    int scanRecordFps = 15;
    ReconstructionOptions.Quality textureQuality;

    // properties

    IScanner.State??? ScannerState;

    // events

    event ScanProcessed();

    // methods

    virtual override void ApplyARConfigurationChange(ARSessionChangesCollector.ARSessionRunProperties properties);
    void CancelProcessing();
    void DeleteScan(string scanId);
    SavedScan GetSavedScan(string scanId);
    List<string> GetSavedScans();
    string GetScanId();
    float GetScanProgress();
    void GetScanQuality(string scanId, Action<ScanQualityResult> onResult);
    void PauseScanning();
    void Restart();
    void ResumeScanning();
    void SaveCurrentScan();
    void SetScanTargetId(string scanTargetId);
    void SetVisualizer(IScanVisualizer newVisualizer);
    void StartProcessing();
    void StartScanning();
    void StopScanning();

    void UploadScan(
        string scanId,
        Action<float> onProgress,
        Action<bool, string> onResult
    );
};

Inherited Members

public:
    // properties

    bool AreFeaturesEnabled;
    bool CanInitialize;
    bool Initialized;

    // methods

    void Deinitialize();
    void DisableFeatures();
    void EnableFeatures();
    void Initialize();
    virtual abstract void ApplyARConfigurationChange(ARSessionChangesCollector.ARSessionRunProperties properties) = 0;

Detailed Documentation

The ARScanManager can be placed in a scene to easily manage scanning, visualization, and reconstruction.

Fields

float maxScanDistance = 5f

Maximum range, in meters, at which the scanner will collect data. This should be set to values between 0.1 and 5.0 meters and will be clamped to this range if not. When capturing scans for VPS activation, this parameter should be set to 5.

ReconstructionOptions.Quality meshQuality

Quality level to use when building the mesh. Higher quality levels will produce a mesh with greater geometric detail, but will take more time and memory to process and require more resources to render and store. In general, this setting will have a larger impact on processing speed than textureQuality.

ReconstructionOptions.ReconstructionMode reconstructionMode

The mode used to generate the textured mesh from the scanning data.

bool recordLocation = true

Whether to record location data in the scan. When capturing scans for VPS activation, this must be true.

int scanRecordFps = 15

The rate at which images in the scan will be recorded, expressed in frames per second. This should be set to a value between 1 and 15 and will be clamped to this range if not. When capturing scans for VPS activation, this parameter should be set to 15 fps. For other cases, a lower FPS such as 3 can lead to a faster reconstruction without loss of quality.

ReconstructionOptions.Quality textureQuality

Quality level to use when generating the texture for the mesh. Higher quality levels will produce a sharper, more accurate texture, but will take more time and memory to process and require more resources to render and store. In general, this setting will have a smaller impact on processing speed than meshQuality.

Properties

IScanner.State??? ScannerState

Returns the current state of the scanner. See IScanner.State for details on scanner states and the transitions between them.

Events

event ScanProcessed()

Invoked when the scan has finished processing.

Methods

virtual override void ApplyARConfigurationChange(ARSessionChangesCollector.ARSessionRunProperties properties)

Inheritors should override this to modify session configuration settings based on their script's needs.

注釈

This is executed as a result of the ARSession being run, which may or may not be triggered by a call to RaiseConfigurationChanged().

void CancelProcessing()

Cancel processing a scan.

  • This can be called in the Processing state.

  • The scanner will transition to the Cancelling state.

  • Within a few seconds, it will transition to the Cancelled state.

void DeleteScan(string scanId)

Delete a saved scan.

Parameters:

scanId

the ID of the scan to delete

SavedScan GetSavedScan(string scanId)

Returns the SavedScan for a given ID.

List<string> GetSavedScans()

Returns all the IDs of previously saved scans.

string GetScanId()

Returns a unique ID for the current scan. The scan ID is valid once the scan has started (once the scanner has entered the Scanning state).

float GetScanProgress()

Returns the current progress of scan processing, as a value between 0 and 1. This is only available in the Processing state.

void GetScanQuality(string scanId, Action<ScanQualityResult> onResult)

Given a scan ID, returns the quality estimation of the scan for VPS activation.

Parameters:

scanId

the ID of the scan

onResult

Invoked with the ScanQualityResult when the quality has been computed

void PauseScanning()

Temporarily pauses a scan that is in progress.

The scan can be resumed later by calling ResumeScanning.

  • This can be called in the Scanning state.

  • The scanner will transition to the Paused state.

void Restart()

Reset the scanner for another scan.

  • This can be called in the ScanCompleted, Done, Error, or Cancelled states.

  • The scanner will transition to the Ready state.

void ResumeScanning()

Resumes a scan that has been paused.

  • This can be called in the Paused state.

  • The scanner will transition to the Scanning state.

void SaveCurrentScan()

Saves a processed scan.

  • This can be called in the Done state.

void SetScanTargetId(string scanTargetId)

Set the current scan target for VPS activation. You must call this method prior to saving the scan if you intend to upload it for VPS activation.

A scan target represents a location that can be scanned and activated for VPS. You can find scan targets near the user and obtain their IDs using IScanTargetClient.

Calling Restart will clear the scan target ID.

Parameters:

scanTargetId

the ID of the scan target for the current scan

void SetVisualizer(IScanVisualizer newVisualizer)

Set a visualizer to show scans in progress. Visualizers will be fed with voxel or raycast data as they need. This should be called before StartScanning.

Parameters:

newVisualizer

the visualizer to use

void StartProcessing()

Starts processing a scan.

Processing generates a TexturedMesh from the raw scan data. Depending on the options and the, processing capabilities of the user's device, this may take anywhere from a few seconds to several minutes.

  • This can be called in the ScanCompleted state.

  • The scanner will transition to the Processing state.

void StartScanning()

Start scanning the scene.

  • This can be called in the Ready state.

  • The scanner will transition to the Scanning state.

If SetVisualizer has been called, this will also activate the visualization.

void StopScanning()

Ends the scan.

  • This can be called in the Scanning or Paused states.

  • The scanner will transition to the ScanCompleted state.

void UploadScan(
    string scanId,
    Action<float> onProgress,
    Action<bool, string> onResult
)

Uploads the given scan to Niantic for VPS activation. The scan target ID must be previously set.

Parameters:

scanId

the ID of the scan to upload

onProgress

Callback invoked periodically during upload to indicate progress (between 0 and 1).

onResult

Callback invoked when upload completes or fails. The first argument is true on success and false on failure; the second argument describes the error in the failure case.