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
Provided only when creating a new frame source. It is only accessed during the Assemble() process.
On desktops or mobile phones, 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 are controlled by EasyAR. On HMDs, this camera is only used to display diagnostic text in front of the eyes, not for rendering; the camera is not controlled by EasyAR.
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
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; }
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
Provided only when creating a new frame source. It is accessed when CameraFrameStarted is true.
Provides the device camera(s) supplying the camera frame data. If the frame 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 only accessed during the Assemble() process.
Provides the display system information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get the default display information.
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
Provided only when creating a new frame source. It is only accessed 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 finishes.
protected override Optional<bool> IsAvailable { get; }
IsCameraUnderControl
Provided only when creating a new frame source. It is only accessed during the Assemble() process.
When true, the session updates the camera's transform and renders the camera image.
When creating an HMD extension, this 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 only accessed 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 an HMD device.
protected override bool IsHMD { get; }
Opened
Whether the camera is open.
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/stops capturing video stream data during ARSession runtime. After the session starts, capturing only begins 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 only accessed 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. You can use this method to destroy resources created in StartSession() and during session operation, and restore the internal state. This method is guaranteed to be called before the session is destroyed. If the frame source is destroyed before the session, this method 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 device will automatically Open() after the ARSession starts.
public void Open()
Events
DeviceClosed
Device closed event.
public event Action DeviceClosed
DeviceOpened
Device opened event, where the bool value indicates success.
public event Action<bool, PermissionStatus, string> DeviceOpened