Table of Contents

Class MotionTrackerFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

In the scene, control easyar.MotionTrackerCameraDevice of MonoBehaviour, and provide function extension in the Unity environment.

public class MotionTrackerFrameSource : FrameSource
Inheritance
MotionTrackerFrameSource
Inherited Members

Properties

Camera

Provided only when creating a new frame source. It will only be accessed during the Assemble() process.

protected override Camera Camera { get; }

Property Value

CameraCandidate

Alternative of Camera, valid only when Unity XR Origin is not used, and if not set, Camera.main will be used.

public Camera CameraCandidate { get; set; }

Property Value

CameraFrameStarted

Provided only when creating a new frame source. It will be accessed throughout the lifecycle of ARSession.

Whether camera frames start to input.

protected override bool CameraFrameStarted { get; }

Property Value

DesiredFocusMode

Desired focus mode, effective only if modified before the DeviceOpened event or OnEnable.

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

public Optional<MotionTrackerCameraDeviceFocusMode> DesiredFocusMode { get; set; }

Property Value

DesiredFrameRate

Desired device frame rate, effective only if modified before the DeviceOpened event or OnEnable.

public Optional<MotionTrackerCameraDeviceFPS> DesiredFrameRate { get; set; }

Property Value

DesiredMinQualityLevel

Desired minimum allowable quality level, effective only if modified before Assemble().

public Optional<MotionTrackerCameraDeviceQualityLevel> DesiredMinQualityLevel { get; set; }

Property Value

DesiredResolution

Desired resolution, effective only if modified before the DeviceOpened event or OnEnable.

If the image size is modified during the recording of FrameRecorder, the recording data will stop updating and need to be recorded again after closing.

public Optional<MotionTrackerCameraDeviceResolution> DesiredResolution { get; set; }

Property Value

DesiredTrackingMode

Desired tracking mode, effective only if modified before session startup.

public Optional<MotionTrackerCameraDeviceTrackingMode> DesiredTrackingMode { get; set; }

Property Value

DeviceCameras

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

Device camera that provides camera frame data. If camera frame data is provided by multiple cameras, all cameras need to be included in the list.

Ensure the value is correct when CameraFrameStarted is true.

protected override List<FrameSourceCamera> DeviceCameras { get; }

Property Value

DeviceQualityLevel

Obtain the quality of Motion Tracking on the device, and combined with the application scenario, you can judge whether to start Motion Tracking through this value.

public static MotionTrackerCameraDeviceQualityLevel DeviceQualityLevel { get; }

Property Value

Display

Provided only when creating a new frame source. It will only be accessed during the Assemble() process.

Provide display system information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get 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 will only be accessed during the Assemble() process.

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 ends.

protected override Optional<bool> IsAvailable { get; }

Property Value

IsCameraUnderControl

Provided only when creating a new frame source. It will only be accessed during the Assemble() process.

When the value is true, the session will update the camera's transform and render the camera image.

When creating a headset extension, it should be false. You should fully control 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. It will only be accessed during the Assemble() process.

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

Some frame filters behave differently on devices.

protected override bool IsHMD { get; }

Property Value

LocalPointCloud

Current point cloud data position information. Only available when Opened is true.

public List<Vector3> LocalPointCloud { get; }

Property Value

Opened

Whether the camera is open.

public bool Opened { get; }

Property Value

Size

Current image size. Only available when Opened and MonoBehaviour.enabled are both true.

public Vector2Int Size { get; }

Property Value

Methods

Close()

Close device.

public void Close()

HitTestAgainstHorizontalPlane(Vector2)

Perform Hit Test on the horizontal plane detected in real time within the current field of view, and return the position coordinate of the closest 3D point on the plane to the Hit Test ray after clicking on a certain horizontal plane. The pointInView needs to be normalized to [0, 1]^2.

public List<Vector3> HitTestAgainstHorizontalPlane(Vector2 pointInView)

Parameters

pointInView

Returns

HitTestAgainstPointCloud(Vector2)

Perform Hit Test on the current point cloud to get the position coordinate of the closest 3D point on a ray from the camera from near to far. The pointInView needs to be normalized to [0, 1]^2.

public List<Vector3> HitTestAgainstPointCloud(Vector2 pointInView)

Parameters

pointInView

Returns

OnSessionStart(ARSession)

Provided only when creating a new frame source. It will only be accessed during the StartSession() process.

Handle session startup if this frame source has been assembled into Assembly. This method is designed for lazy initialization, and you can do AR-specific initialization work in this method.

protected override void OnSessionStart(ARSession session)

Parameters

session

OnSessionStop()

Provided only when creating a new frame source. It will be accessed during StopSession(bool) or other session stop/damage processes.

Handle session stop if this frame source has been assembled into Assembly. You can use this method to destroy StartSession() and resources created during session operation and restore internal state. This method will be guaranteed to be called before the session is destroyed. If the frame source is destroyed before the session, it will not be called and the session will be damaged.

protected override void OnSessionStop()

Open()

Open device. If Open() and Close() are not manually called, ARSession will automatically open Open() after startup.

public void Open()

Events

DeviceClosed

Device closing event.

public event Action DeviceClosed

Event Type

DeviceOpened

Device opening event, boolean value indicates whether it is successful.

public event Action<bool, PermissionStatus, string> DeviceOpened

Event Type