MotionTrackerFrameSource Class

Description

MonoBehaviour which controls MotionTrackerCameraDevice in the scene, providing a few extensions in the Unity environment.

This frame source is one type of motion tracking device, and will output motion data in a ARSession .


Properties

enabled

C#

public bool enabled { get; set; }

Start/Stop video stream capture when ARSession is running. Capture will start only when MonoBehaviour .enabled is true after session started.

Opened

C#

public bool Opened { get; }

Whether camera is opened.

DeviceQualityLevel

C#

public static MotionTrackerCameraDeviceQualityLevel DeviceQualityLevel { get; }

Get the quality of Motion Tracking on the device. You can decide whether to start Motion Tracking.

FrameRateRange

C#

public Vector2 FrameRateRange { get; }

Frame rate range. Only usable when MotionTrackerFrameSource.Opened is true.

Size

C#

public Vector2Int Size { get; }

Current preview size. Only usable when both MotionTrackerFrameSource.Opened and MonoBehaviour .enabled is true.

LocalPointCloud

C#

public List< Vector3 > LocalPointCloud { get; }

the vector of point cloud coordinate. Only usable when MotionTrackerFrameSource.Opened is true.

DesiredFocusMode

C#

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

Desired focus mode. Only effective if modified before the MotionTrackerFrameSource.DeviceOpened event or OnEnable.

Note: focus switch may not work on some devices due to hardware or system limitation.

DesiredResolution

C#

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

Desired frame resolution. Only effective if modified before the MotionTrackerFrameSource.DeviceOpened event or OnEnable.

If the image size is modified during the FrameRecorder recording process, the recording data will stop updating. You will need to stop and restart the recording.

DesiredFrameRate

C#

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

Desired device frame rate. Only effective if modified before the MotionTrackerFrameSource.DeviceOpened event or OnEnable.

DesiredMinQualityLevel

C#

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

Desired minimum allowed quality level on the device. Only effective if modified before ARSession.Assemble .

DesiredTrackingMode

C#

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

Desired tracking mode. Only effective if modified before the session starts.

CameraCandidate

C#

public Camera CameraCandidate { get; set; }

MotionTrackerFrameSource.Camera candidate. Only effective if Unity XR Origin is not used. Camera.main will be used if not specified.


Events

DeviceOpened

C#

public event Action<bool, PermissionStatus , string> DeviceOpened

Event when device opened. The bool value indicates if open success.

DeviceClosed

C#

public event Action DeviceClosed

Event when device closed.


Methods

Open

C#

public void Open()

Open device. If neither MotionTrackerFrameSource.Open nor MotionTrackerFrameSource.Close is called manually, MotionTrackerFrameSource.Open will be automatically invoked upon ARSession startup.

Close

C#

public void Close()

Close device.

HitTestAgainstHorizontalPlane

C#

public List< Vector3 > HitTestAgainstHorizontalPlane( Vector2 pointInView)

Performs ray cast from the user’s device in the direction of given screen point. Intersections with horizontal plane is detected in real time in the current field of view,and return the 3D point nearest to ray on horizontal plane. pointInView should be normalized to [0, 1]^2.

HitTestAgainstPointCloud

C#

public List< Vector3 > HitTestAgainstPointCloud( Vector2 pointInView)

Perform hit test against the point cloud and return the nearest 3D point. pointInView should be normalized to [0, 1]^2.