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
Provided only when creating a new frame source. It is accessed only during the Assemble() process.
On desktop or mobile devices, this camera represents the Camera in the virtual world corresponding to the physical camera device in the real environment. Its projection matrix and position will correspond to the real camera and be controlled by EasyAR. On an HMD, this camera is only used to display diagnostic text in front of the eyes, not for scene rendering, and the camera is not controlled by EasyAR.
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
Provided only when creating a new frame source. It is accessed throughout the lifetime of the ARSession.
Whether camera frame input has started.
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
Provided only when creating a new frame source. It is accessed when CameraFrameStarted is true.
Provides the device camera supplying the camera frame data. If the data comes from multiple cameras, the list must include all of them.
Ensure the value is correct when CameraFrameStarted is true.
protected override List<FrameSourceCamera> DeviceCameras { get; }
Display
Provided only when creating a new frame source. It is accessed only during the Assemble() process.
Provides display system information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get the default display information.
protected override IDisplay Display { get; }
FrameRateRange
Frame rate range. Available only when Opened is true.
public Vector2 FrameRateRange { get; }
IsAvailable
Provided only when creating a new frame source. It is accessed only 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; }
IsCameraUnderControl
Provided only when creating a new frame source. It is accessed only during the Assemble() process.
When true, the session updates the camera's transform and renders the camera image.
When creating an HMD extension, it should be false. You should have full control over the 3D camera in the scene. You should handle camera rendering, especially in VST mode.
protected override bool IsCameraUnderControl { get; }
IsHMD
Provided only when creating a new frame source. It is accessed only during the Assemble() process.
Whether the current frame source is a head-mounted display (HMD). If it is an HMD, diagnostic information will be displayed on a 3D board in front of the camera.
Some frame filters behave differently when running on the device.
protected override bool IsHMD { get; }
Opened
Whether the camera is open.
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/stops collecting video stream data while the ARSession is running. Collection starts only after session startup and when MonoBehaviour.enabled is true.
public bool enabled { get; set; }
Methods
Close()
Closes the device.
public void Close()
OnSessionStart(ARSession)
Provided only when creating a new frame source. It is accessed only during the StartSession() process.
Handles session startup if this frame source is assembled into the Assembly. This method is designed for lazy initialization; you can perform AR-specific initialization here.
protected override void OnSessionStart(ARSession session)
Parameters
session
OnSessionStop()
Provided only when creating a new frame source. It is accessed during StopSession(bool) or other session stop/corruption processes.
Handles session stop if this frame source is assembled into the Assembly. Use this method to destroy resources created in StartSession() and during session operation, and to restore internal state. This method is 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 corrupted.
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
Device closed event.
public event Action DeviceClosed
DeviceOpened
Device opened event. The bool value indicates success.
public event Action<bool, PermissionStatus, string> DeviceOpened