Skip to main content

Headset Calibration API Reference (Unity)

The public C# API of AR 51 Headset Calibration, namespace AR51.HeadsetCalibration. 3.0.303

For usage, see the Developer guide. For the core SDK types, see the Unity SDK API reference.

HeadsetCalibrator​

class · sealed Unity component
namespace AR51.HeadsetCalibration;

public sealed class HeadsetCalibrator : MonoBehaviour

Lines up the headset's world with the AR 51 capture space, automatically and continuously.

MemberTypeDescription
RigRootTransform (field)The object that gets lined up. Empty = root of the main camera.
SmoothingSecondsfloat (field)How gently later corrections are applied (seconds).
StateCalibrationState (get)How well the headset's world lines up right now.
HintCalibrationHint (get)What the wearer can do right now; None when nothing.
HasSolutionbool (get)true once the headset has been aligned at least once.
HeadsetTrackedbool (get)The headset reports a valid pose this frame.
HeadsetMountedbool (get)The headset is on a head (true when the device doesn't say).
SkeletonIdstring (get)The wearer's tracked person, or null while finding them.

Events​

public event Action<CalibrationState, CalibrationState> StateChanged; // (previous, current)
public event Action<CalibrationHint> HintChanged;
EventRaised when
StateChangedThe state changes — with the previous and the new state.
HintChangedThe hint changes.

Methods​

MethodDescription
ResetCalibration()Start fresh (e.g. a new wearer). The view stays where it is until the new alignment is ready.

CalibrationHintPanel​

class · sealed Unity component
namespace AR51.HeadsetCalibration;

public sealed class CalibrationHintPanel : MonoBehaviour

Optional in-headset panel that shows the calibrator's hint. Its fields match the Settings reference.

HintTexts​

class · nested · sealed · serializable

The message shown for each hint.

MemberTypeDescription
StepIntoViewstringText for the StepIntoView hint.
HeadsetTrackingLoststringText for the HeadsetTrackingLost hint.
FindingYoustringText for the FindingYou hint.
HoldStillstringText for the HoldStill hint.
KeepWalkingstringText for the KeepWalking hint.
AlignedstringThe "You're aligned" confirmation.
For(CalibrationHint hint)stringReturns the text for a hint.

CalibrationState​

enum
ValueMeaning
NotAlignedNot lined up yet; the view hasn't been moved.
AligningRoughly lined up; a few steps of walking make it precise.
AlignedLined up; corrections from now on are small and smooth.
LostWas lined up but can't follow right now (e.g. the headset lost tracking); the view stays until it recovers.

CalibrationHint​

enum
ValueMeaningDefault panel text
NoneNothing to do.—
StepIntoViewThe cameras see nobody.Step into the capture area so the cameras can see you.
HeadsetTrackingLostThe headset lost its own tracking.Headset tracking lost. Make sure the room is well lit.
FindingYouThe wearer isn't recognised yet.Walk a few steps so the system can find you.
HoldStillNeeds a steady look for a moment.Hold still for a moment and look straight ahead.
KeepWalkingRoughly lined up; finishing.Walk a few more steps to finish aligning.

Examples​

Start gameplay once the headset is aligned​

Keep your content hidden until the wearer is lined up, then show it. Lost alignment later doesn't hide it again — the view stays put while the calibrator recovers.

StartWhenAligned.cs
using AR51.HeadsetCalibration;
using UnityEngine;

public class StartWhenAligned : MonoBehaviour
{
public HeadsetCalibrator Calibrator;
public GameObject Content; // your gameplay root, inactive at start

private void OnEnable()
{
Calibrator.StateChanged += OnStateChanged;
Content.SetActive(Calibrator.HasSolution); // already aligned, e.g. after a scene reload
}

private void OnDisable()
{
Calibrator.StateChanged -= OnStateChanged;
}

private void OnStateChanged(CalibrationState previous, CalibrationState current)
{
if (current == CalibrationState.Aligned)
Content.SetActive(true);
}
}

Reset for a new wearer​

Call ResetCalibration() when a different person puts the headset on — for example from an operator button. The view stays where it is until the new wearer is aligned.

NewWearerButton.cs
using AR51.HeadsetCalibration;
using UnityEngine;

public class NewWearerButton : MonoBehaviour
{
public HeadsetCalibrator Calibrator;

// Hook this up to a UI Button's OnClick.
public void OnNewWearer()
{
Calibrator.ResetCalibration();
}
}

Show your own hints​

Listen to HintChanged and show your own UI — see the complete example in the Developer guide.

Was this page helpful?