Table of Contents

Class InertialCameraDeviceFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

Controlseasyar.InertialCameraDevicein the scene, providing functional extensions in the Unity environment.

This frame source is a 5DOF (rotation + horizontal displacement) tracking device, outputting motion data withinARSession.

public class InertialCameraDeviceFrameSource : FrameSource
Inheritance
InertialCameraDeviceFrameSource
Inherited Members

Fields

DesiredFocusMode

The desired focus mode. Must be modified before theDeviceOpenedevent or OnEnable to take effect.

Note: Due to hardware or system limitations, the focus switch might be ineffective on some devices.

public InertialCameraDeviceFocusMode DesiredFocusMode

Field Value

Properties

Camera

Provided only when creating a new frame source. Accessed only duringAssemble().

On desktop devices or phones, this camera represents the virtualCameracorresponding to the real-world camera device. Its projection matrix and position correspond to the physical camera and are controlled by EasyAR. On head-mounted displays, this camera is only used to display diagnostic text in front of the eyes, not for rendering the scene view; the camera is not controlled by EasyAR.

protected override Camera Camera { get; }

Property Value

CameraCandidate

Alternative toCamera, only effective when Unity XR Origin is not used. If unset, Camera.main will be used.

public Camera CameraCandidate { get; set; }

Property Value

CameraFrameStarted

Provided only when creating a new frame source. Accessed throughout the lifetime of theARSession.

Whether camera frames have started input.

protected override bool CameraFrameStarted { get; }

Property Value

DesiredSize

The desired camera image size. Must be modified before theDeviceOpenedevent to take effect.

Uses the closest size value fromSupportedSize. If not set, the default will be used.

public Optional<Vector2Int> DesiredSize { get; set; }

Property Value

DeviceCameras

Provided only when creating a new frame source. Accessed whenCameraFrameStarted is true.

Provides the device camera(s) supplying the camera frame data. If frame data comes from multiple cameras, the list must include all.

Ensure the value is correct whenCameraFrameStarted is true.

protected override List<FrameSourceCamera> DeviceCameras { get; }

Property Value

Display

Provided only when creating a new frame source. Accessed only duringAssemble().

Provides display system information. You can useDefaultSystemDisplayorDefaultHMDDisplayto get default display information.

protected override IDisplay Display { get; }

Property Value

FrameRateRange

Frame rate range. Only available whenOpened is true.

public Vector2 FrameRateRange { get; }

Property Value

IsAvailable

Provided only when creating a new frame source. Accessed only duringAssemble().

Whether the current frame source is available.

If the value is null,CheckAvailability()will be called, and the value will be obtained after theCoroutineends.

protected override Optional<bool> IsAvailable { get; }

Property Value

IsCameraUnderControl

Provided only when creating a new frame source. Accessed only duringAssemble().

When true, the session updates the camera's transform and renders the camera image.

When creating a head-mounted extension, it should be false. You should have full control over the 3D camera in the scene. You should handle camera rendering, especially in VST mode.

protected override bool IsCameraUnderControl { get; }

Property Value

IsHMD

Provided only when creating a new frame source. Accessed only duringAssemble().

Whether the current frame source is a head-mounted display. If it is, diagnostic information will be displayed on a 3D board in front of the camera.

Some frame filters behave differently when running on a device.

protected override bool IsHMD { get; }

Property Value

Opened

Whether the camera is open.

public bool Opened { get; }

Property Value

Size

Current image size. Only available whenOpened is true.

Set uses the closest size value fromSupportedSize.

If the image size is modified duringFrameRecorderrecording, recorded data will stop updating; recording needs to be restarted after closing.

public Vector2Int Size { get; set; }

Property Value

SupportedSize

All supported image sizes for the current device. Only available whenOpened is true.

public List<Vector2Int> SupportedSize { get; }

Property Value

Methods

Close()

Closes the device.

public void Close()

OnSessionStart(ARSession)

Provided only when creating a new frame source. Accessed only duringStartSession().

Handles session startup, if this frame source has been assembled intoAssembly. This method is designed for deferred initialization; you can perform AR-specific initialization here.

protected override void OnSessionStart(ARSession session)

Parameters

session

OnSessionStop()

Provided only when creating a new frame source. Accessed duringStopSession(bool)or other session stop/corruption processes.

Handles session stop, if this frame source has been assembled intoAssembly. Use this method to destroy resources created inStartSession()and during session operation and restore internal state. This method is guaranteed to be called before session destruction. If the frame source is destroyed before the session, this method won't be called, and the session will be corrupted.

protected override void OnSessionStop()

Open()

Opens the device. IfOpen()andClose()are not called manually,ARSessionwill automaticallyOpen()when started.

public void Open()

ResetInertial()

Resets the state.

public void ResetInertial()

Events

DeviceClosed

Device closed event.

public event Action DeviceClosed

Event Type

DeviceOpened

Device opened event. The bool value indicates success or failure.

public event Action<bool, PermissionStatus, string> DeviceOpened

Event Type