Skip to main content

Reloc Score

This feature is only compatible for map-based relocalization.

For map-based relocalization, you can query the RelocalizationScore to find out how close it is to successful relocalization. Relocalization Score is a float ranging from 0f to 1f: A small value means that the relocalization process is not able to recognize the environment. The closer the score is to 1f, the closer it is to a successful relocalization. Note that this scores varies with the position of the device, so if the score remains low, the user is advised to move from their current position.

Alternatively you can listen to OnRelocalizationScoreUpdated event for whenever the score is updated, which is after every frame that has finished evaluation.

// ARSharedAnchorManager.cs

// Get the current relocalization score
public float RelocalizationScore { get; }

// Attach a callback to this event to listen for whenever the relocalization score changes
public delegate void RelocalizationScoreUpdated(float score);
public event RelocalizationScoreUpdated OnRelocalizationScoreUpdated;

Usage Example

[SerializeField]
private ARSharedAnchorManager _sharedAnchorManager;

private void Update()
{
// Use the RelocalizationScore to update a visual indicator e.g.,
// _visualIndicator.Value = _sharedAnchorManager.RelocalizationScore;
}

Alternatively use the event:

[SerializeField]
private ARSharedAnchorManager _sharedAnchorManager;

private void OnEnable()
{
// Subscribe to event
_sharedAnchorManager.OnRelocalizationScoreUpdated += UpdateVisualIndicator;
}

private void OnDisable()
{
// Unsubscribe to event
_sharedAnchorManager.OnRelocalizationScoreUpdated -= UpdateVisualIndicator;
}

private void UpdateVisualIndicator(float score)
{
// Update the visual indicator with the relocalization score value e.g.,
// _visualIndicator.Value = score;
}