MotionTrackerFrameSource Class¶
Description¶
MonoBehaviour which controls MotionTrackerCameraDevice in the scene, providing a few extensions in the Unity environment. Use MotionTrackerFrameSource.Device directly when necessary.
This frame source is one type of motion tracking device, and will output motion data in a ARSession .
Classes¶
public class MotionTrackerFrameSource.MotionTrackerCameraDeviceParameters |
Motion tracker parameters. |
MonoBehaviour Messages¶
private void OnEnable() |
private void OnDisable() |
private void OnDestroy() |
Fields¶
DesiredMotionTrackerParameters¶
- C#
public MotionTrackerFrameSource.MotionTrackerCameraDeviceParameters DesiredMotionTrackerParameters
Desired motion tracker parameters, used only when MotionTrackerFrameSource.Device start.
Properties¶
Device¶
- C#
public MotionTrackerCameraDevice Device { get; }
EasyAR Sense API. Accessible between MotionTrackerFrameSource.DeviceCreated and MotionTrackerFrameSource.DeviceClosed event if available.
DeviceQualityLevel¶
- C#
public MotionTrackerCameraDeviceQualityLevel DeviceQualityLevel { get; }
Get the quality of Motion Tracking on the device. You can decide whether to start Motion Tracking.
OriginCandidate¶
- C#
public XROriginController OriginCandidate { get; set; }
ARSession.Origin candidate. It will be automatically get from the scene or generate if not set.
CameraCandidate¶
- C#
public Camera CameraCandidate { get; set; }
MotionTrackerFrameSource.Camera candidate. It will be automatically get from the scene or generate if not set.
IsHMD¶
- C#
internal protected override bool IsHMD { }
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
If the frame source represent head mounted devices. If true, diagnostics will be displayed on a 3D board in from of camera.
Some frame filter may work different on devices.
Camera¶
- C#
internal protected override Camera Camera { }
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
On desktop or mobile phones, it represents the Camera in the virtual world in reflection of real world camera device, its projection matrix and transform will be set to reflect the real world camera, and it is controlled by EasyAR. On head mounted devices, it is only used to display some diagnostics message in front of your eyes, it is not used for camera image rendering, it is not controled by EasyAR.
IsCameraUnderControl¶
- C#
internal protected override bool IsCameraUnderControl { }
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
When the value is ture, the session will update camera transform depending on the center mode and render camera images.
When creating a HMD extension, it should be false. You should have full control of the 3D camera in the scene. You should handle camera rendering, especially in VST.
Display¶
- C#
internal protected override IDisplay Display { }
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
Provide display system information. You can use Display.DefaultSystemDisplay or Display.DefaultHMDDisplay for default display.
IsAvailable¶
- C#
internal protected override Optional<bool> IsAvailable { }
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
If the frame source is available.
If the value equals null, FrameSource.CheckAvailability will be called and the value will be accessed after Coroutine finish.
AvailableCenterMode¶
- C#
internal protected virtual IReadOnlyList< ARSession.ARCenterMode > AvailableCenterMode { }
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
All available center modes.
Events¶
DeviceCreated¶
- C#
public event Action DeviceCreated
Event when MotionTrackerFrameSource.Device created.
DeviceOpened¶
- C#
public event Action DeviceOpened
Event when MotionTrackerFrameSource.Device opened.
DeviceClosed¶
- C#
public event Action DeviceClosed
Event when MotionTrackerFrameSource.Device closed.
Methods¶
Open¶
- C#
public void Open()
Open device.
Close¶
- C#
public void Close()
Close device.
HitTestAgainstHorizontalPlane¶
Performs ray cast from the user’s device in the direction of given screen point. Intersections with horizontal plane is detected in real time in the current field of view,and return the 3D point nearest to ray on horizontal plane. pointInView should be normalized to [0, 1]^2.
HitTestAgainstPointCloud¶
Perform hit test against the point cloud and return the nearest 3D point. pointInView should be normalized to [0, 1]^2.
OnSessionStart¶
- C#
private override void OnSessionStart( ARSession session)
Provide only when creating a new frame source. It will only be accessed during ARSession.StartSession .
Handle session start if the frame source was assembled into ARSession.Assembly . It is designed for lazy initialization and you can do AR specific initialization work in the method.
OnSessionStop¶
- C#
private override void OnSessionStop()
Provide only when creating a new frame source. It will be accessed during ARSession.StopSession or other session stop/break procedure.
Handle session stop if the frame source was assembled into ARSession.Assembly . You can use this method to destroy and resources created in ARSession.StartSession and during the session running and resotre inner state. It is ensured to be called before session destroy. If the frame source was destroyed before session, it will not be called and session will break.
CheckAvailability¶
- C#
private virtual System.Collections.IEnumerator CheckAvailability()
Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .
Coroutine to check frame source availability when FrameSource.IsAvailable equals null.