Table of Contents

Class ThreeDofCameraDeviceFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

A MonoBehaviour that controls the 3DOF camera device (ThreeDofCameraDeviceFrameSource) in the scene, providing functional extensions in the Unity environment.

This frame source is a 3DOF rotation tracking device, outputting rotation data within the ARSession.

public class ThreeDofCameraDeviceFrameSource : FrameSource
Inheritance
ThreeDofCameraDeviceFrameSource
Inherited Members

Fields

DesiredFocusMode

The desired focus mode. Modifications are only effective before the DeviceOpened event or OnEnable.

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

public ThreeDofCameraDeviceFocusMode DesiredFocusMode

Field Value

Properties

Camera

Provided only when creating a new frame source. It is only accessed during Assemble().

On desktop or mobile devices, this camera represents the virtual world counterpart of the physical camera device, with its projection matrix and position controlled by EasyAR to match the real camera. On an HMD, this camera is solely used to display diagnostic text in front of the user's eyes; it is not used for rendering the scene view and is not controlled by EasyAR.

protected override Camera Camera { get; }

Property Value

CameraCandidate

An alternative to Camera, valid only when the Unity XR Origin is not used. If not set, Camera.main is used.

public Camera CameraCandidate { get; set; }

Property Value

CameraFrameStarted

Provided only when creating a new frame source. It is accessed throughout the lifetime of the ARSession.

Whether camera frame input has started.

protected override bool CameraFrameStarted { get; }

Property Value

DesiredSize

The desired camera image size. Modifications are only effective before the DeviceOpened event.

Uses the size closest to the value in SupportedSize. If not set, the default value is used.

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

Property Value

DeviceCameras

Provided only when creating a new frame source. It is accessed when CameraFrameStarted is true.

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

Ensure the value is correct when CameraFrameStarted is true.

protected override List<FrameSourceCamera> DeviceCameras { get; }

Property Value

Display

Provided only when creating a new frame source. It is only accessed during Assemble().

Provides display system information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get the default display information.

protected override IDisplay Display { get; }

Property Value

FrameRateRange

Frame rate range. Only available when Opened is true.

public Vector2 FrameRateRange { get; }

Property Value

IsAvailable

Provided only when creating a new frame source. It is only accessed during Assemble().

Whether the current frame source is available.

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

protected override Optional<bool> IsAvailable { get; }

Property Value

IsCameraUnderControl

Provided only when creating a new frame source. It is only accessed during Assemble().

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

When creating an HMD extension, this should be false. You should have full control over the 3D camera in the scene and handle its rendering, especially in VST mode.

protected override bool IsCameraUnderControl { get; }

Property Value

IsHMD

Provided only when creating a new frame source. It is only accessed during Assemble().

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

Some frame filters behave differently when running on HMD devices.

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 when Opened is true.

Setting this uses the size closest to the value in SupportedSize.

If the image size is modified during FrameRecorder recording, recorded data will stop updating; recording must be stopped and restarted.

public Vector2Int Size { get; set; }

Property Value

SupportedSize

All supported image sizes for the current device. Only available when Opened 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. It is only accessed during StartSession().

Handles session startup if this frame source is assembled into the Assembly. This method is designed for lazy 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. It is accessed during StopSession(bool) or other session stopping/corruption processes.

Handles session stopping if this frame source is assembled into the Assembly. Use this method to destroy resources created in StartSession() or during session runtime and restore internal state. This method is guaranteed to be called before the session is destroyed. 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. If Open() and Close() are not called manually, ARSession will automatically call Open() upon starting.

public void Open()

Events

DeviceClosed

Event triggered when the device is closed.

public event Action DeviceClosed

Event Type

DeviceOpened

Event triggered when the device is opened. The bool value indicates success.

public event Action<bool, PermissionStatus, string> DeviceOpened

Event Type