Table of Contents

Class MotionTrackerFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

Controlseasyar.MotionTrackerCameraDevicein the scene, providing feature extensions within the Unity environment.

This frame source is a motion-tracking device that outputs motion data inARSession.

public class MotionTrackerFrameSource : FrameSource
Inheritance
MotionTrackerFrameSource
Inherited Members

Properties

Camera

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

Ondesktopdevicesorphones,thiscameracorrespondstotheinthevirtualworldthatrepresentsthecameradeviceintherealenvironment;itsprojectionmatrixandpositionwillcorrespondtotherealcamerasandbecontrolledbyEasyAR.Onheadsets,thiscameraisonlyusedtodisplaysomediagnostictextinfrontoftheeyesandisnotusedforrendering;thecameraisnotcontrolledbyEasyAR.

protected override Camera Camera { get; }

CameraCandidate

An alternative toCamera, valid only when Unity XR Origin is not used. If not set, Camera.main will be used.

public Camera CameraCandidate { get; set; }

CameraFrameStarted

Providedonlywhencreatinganewframesource.Itisaccessedthroughouttheentirelifecycleof.

Whetherthecameraframehasstartedinput.

protected override bool CameraFrameStarted { get; }

DesiredFocusMode

Desired focus mode. Modifications are effective only before theDeviceOpened event or OnEnable.

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

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

DesiredFrameRate

Desired device frame rate. Modifications are effective only before theDeviceOpened event or OnEnable.

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

DesiredMinQualityLevel

Desired minimum allowed quality level. Modifications are effective only beforeAssemble().

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

DesiredResolution

Desired resolution. Modifications are effective only before theDeviceOpened event or OnEnable.

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

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

DesiredTrackingMode

Desired tracking mode. Modifications are effective only before the session starts.

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

DeviceCameras

Providedonlywhencreatinganewframesource.Itisaccessedwhenistrue.

Thedevicecamerathatprovidesthecameraframedata.Ifthecameraframedataisprovidedbymultiplecameras,thelistshouldincludeallofthem.

Ensurethatthevalueiscorrectwhenistrue.

protected override List<FrameSourceCamera> DeviceCameras { get; }

DeviceQualityLevel

Gets the quality of Motion Tracking on the device. Combined with the application scenario, this value can determine whether to enable Motion Tracking.

public static MotionTrackerCameraDeviceQualityLevel DeviceQualityLevel { get; }

Display

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

Providesdisplaysysteminformation.Youcanuseortoobtaindefaultdisplayinformation.

protected override IDisplay Display { get; }

FrameRateRange

Frame rate range. Only available whenOpened is true.

public Vector2 FrameRateRange { get; }

IsAvailable

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

Whetherthecurrentframesourceisavailable.

Ifthevalueisnull,willbecalled,andthevaluewillbeobtainedaftertheends.

protected override Optional<bool> IsAvailable { get; }

IsCameraUnderControl

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

Whenthevalueistrue,thesessionwillupdatethecamera'stransformandrenderthecameraimage.

Whencreatingaheadsetextension,itshouldbefalse.Youshouldhavefullcontroloverthe3Dcamerainthescene.Youshouldhandlecamerarendering,especiallyinVSTmode.

protected override bool IsCameraUnderControl { get; }

IsHMD

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

Whetherthecurrentframesourceisaheadset.Ifitisaheadset,diagnosticinformationwillbedisplayedona3Dboardinfrontofthecamera.

Someframefiltersmayoperatedifferentlyonthedevice.

protected override bool IsHMD { get; }

LocalPointCloud

Current point cloud data position information. Only available whenOpened is true.

public List<Vector3> LocalPointCloud { get; }

Opened

Whetherthecameraisopen.

public bool Opened { get; }

Size

Current image size. Only available when bothOpened andMonoBehaviour.enabled are true.

public Vector2Int Size { get; }

enabled

Starts/stopscollectingvideostreamdataduringruntime.Collectionwillonlystartafterthesessionstartsandwhen.enabledistrue.

public bool enabled { get; set; }

Methods

Close()

Closethedevice.

public void Close()

HitTestAgainstHorizontalPlane(Vector2)

Performs a Hit Test on horizontal planes detected in real-time within the current field of view. After tapping on a horizontal plane, returns the position coordinates of the 3D point closest to the Hit Test ray on that plane.pointInView needs to be normalized to [0, 1]^2.

public List<Vector3> HitTestAgainstHorizontalPlane(Vector2 pointInView)

Parameters

pointInView

HitTestAgainstPointCloud(Vector2)

Performs a Hit Test in the current point cloud, obtaining the position coordinates of the nearest 3D point along a ray from near to far from the camera.pointInView needs to be normalized to [0, 1]^2.

public List<Vector3> HitTestAgainstPointCloud(Vector2 pointInView)

Parameters

pointInView

OnSessionStart(ARSession)

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheStartSessionprocessof.

Handlessessionstartupifthisframesourcehasbeenassembledinto.Thismethodisdesignedforlazyinitialization;youcanperformAR-specificinitializationworkinthismethod.

protected override void OnSessionStart(ARSession session)

Parameters

session

OnSessionStop()

Providedonlywhencreatinganewframesource.Itisaccessedduringorothersessionsessionstop/corruptionprocesses.

Handlessessionstopifthisframesourcehasbeenassembledinto.Youcanusethismethodtodestroyresourcescreatedduringandsessionoperationandrestoreinternalstate.Thismethodisguaranteedtobecalledbeforesessiondestruction.Iftheframesourceisdestroyedbeforethesession,itwillnotbecalled,andthesessionwillbecorrupted.

protected override void OnSessionStop()

Open()

Opens the device. IfOpen() andClose() are not called manually,ARSession will automaticallyOpen() after startup.

public void Open()

Events

DeviceClosed

Theeventfordeviceclosing.

public event Action DeviceClosed

DeviceOpened

Theeventfordeviceopening,whereabooleanvalueindicateswhetheritwassuccessful.

public event Action<bool, PermissionStatus, string> DeviceOpened