Table of Contents

Class ARKitFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

A MonoBehaviour that controls the ARKit camera device (easyar.ARKitCameraDevice) in the scene, providing extended functionality in the Unity environment.

This frame source is a motion-tracking device that outputs motion data within an ARSession.

public class ARKitFrameSource : FrameSource
Inheritance
ARKitFrameSource
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, focus switching may be ineffective on some devices.

public ARKitCameraDeviceFocusMode DesiredFocusMode

Properties

Camera

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

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

protected override Camera Camera { get; }

CameraCandidate

Alternative to Camera, effective only when Unity XR Origin is not used. If not set, Camera.main is used.

public Camera CameraCandidate { get; set; }

CameraFrameStarted

Providedonlywhencreatinganewframesource.Itisaccessedthroughouttheentirelifecycleof.

Whetherthecameraframehasstartedinput.

protected override bool CameraFrameStarted { get; }

DesiredFrameRate

Desired camera image frame rate. Modifications are only effective before the DeviceOpened event.

Uses the closest value from SupportedFrameRate. If not set, the default value is used.

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

DesiredSize

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

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

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

DeviceCameras

Providedonlywhencreatinganewframesource.Itisaccessedwhenistrue.

Thedevicecamerathatprovidesthecameraframedata.Ifthecameraframedataisprovidedbymultiplecameras,thelistshouldincludeallofthem.

Ensurethatthevalueiscorrectwhenistrue.

protected override List<FrameSourceCamera> DeviceCameras { get; }

Display

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

Providesdisplaysysteminformation.Youcanuseortoobtaindefaultdisplayinformation.

protected override IDisplay Display { get; }

FrameRate

Current frame rate of the device. Only available when Opened is true.

Set uses the closest value from SupportedFrameRate.

public double FrameRate { get; set; }

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; }

Opened

Whetherthecameraisopen.

public bool Opened { get; }

Size

Current image size. Only available when Opened is true.

Set uses the closest size value from SupportedSize.

If the image size is modified during FrameRecorder recording, recording data will stop updating; you need to close and restart recording.

public Vector2Int Size { get; set; }

SupportedFrameRate

All supported frame rates for the current device. Only available when Opened is true.

public List<double> SupportedFrameRate { get; }

SupportedSize

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

public List<Vector2Int> SupportedSize { get; }

enabled

Starts/stopscollectingvideostreamdataduringruntime.Collectionwillonlystartafterthesessionstartsandwhen.enabledistrue.

public bool enabled { get; set; }

Methods

Close()

Closethedevice.

public void Close()

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. If Open() and Close() are not called manually, the device will automatically Open() after the ARSession starts.

public void Open()

Events

DeviceClosed

Theeventfordeviceclosing.

public event Action DeviceClosed

DeviceOpened

Theeventfordeviceopening,whereabooleanvalueindicateswhetheritwassuccessful.

public event Action<bool, PermissionStatus, string> DeviceOpened