Table of Contents

Class InertialCameraDeviceFrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

Controls the easyar.InertialCameraDevice in the scene, providing functional extensions within the Unity environment.

This frame source is a 5DOF (rotation + horizontal displacement) tracking device, outputting motion data in the ARSession.

public class InertialCameraDeviceFrameSource : FrameSource
Inheritance
InertialCameraDeviceFrameSource
Inherited Members

Fields

DesiredFocusMode

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

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

public InertialCameraDeviceFocusMode DesiredFocusMode

Properties

Camera

Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof.

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

protected override Camera Camera { get; }

CameraCandidate

Alternative to Camera, valid 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; }

DesiredSize

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

Uses the closest size in 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; }

FrameRateRange

Frame rate range. Available only when Opened 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; }

Opened

Whetherthecameraisopen.

public bool Opened { get; }

Size

Current image size. Available only when Opened is true.

Set uses the closest size in value from SupportedSize.

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

public Vector2Int Size { get; set; }

SupportedSize

All supported image sizes for the current device. Available only 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 ARSession will automatically Open() upon startup.

public void Open()

ResetInertial()

Resets the state.

public void ResetInertial()

Events

DeviceClosed

Theeventfordeviceclosing.

public event Action DeviceClosed

DeviceOpened

Theeventfordeviceopening,whereabooleanvalueindicateswhetheritwassuccessful.

public event Action<bool, PermissionStatus, string> DeviceOpened