ARSession Class¶
Description¶
MonoBehaviour which controls AR session in the scene. One session contains a set of components assembled as ARAssembly and controls data flow in the whole life cycle. This component is the entrance of AR, it is possible to create a new session class and replace this one in the scene to implement fully different AR workflow.
Relative transform between Camera and a few AR components are controlled by the session, one of those objects is called ARSession.CenterObject , it stays still in the scene, while other objects move relatively to ARSession.CenterObject . This object is selected according to the value of ARSession.CenterMode . See description of ARSession.ARCenterMode for more details.
Enums¶
public enum ARSession.ARCenterMode |
AR center mode. |
public enum ARSession.ARHorizontalFlipMode |
Horizontal flip rendering mode. |
public enum ARSession.SessionState |
The state of session. |
MonoBehaviour Messages¶
private void Start() |
private void OnDestroy() |
Fields¶
CenterMode¶
- C#
public ARSession.ARCenterMode CenterMode
AR center mode. Modify at any time and takes effect immediately. If the specified mode is not available in a session, it will be change to one of the available mode automatically.
HorizontalFlipNormal¶
- C#
public ARSession.ARHorizontalFlipMode HorizontalFlipNormal
Horizontal flip rendering mode for normal camera. Modify at any time and takes effect immediately. Only available when using image or object tracking.
HorizontalFlipFront¶
- C#
public ARSession.ARHorizontalFlipMode HorizontalFlipFront
Horizontal flip rendering mode for front camera. Modify at any time and takes effect immediately. Only available when using image or object tracking.
Properties¶
SpecificTargetCenter¶
- C#
public GameObject SpecificTargetCenter { get; set; }
Specified AR center object. ARSession.CenterObject will be set to this object when ARSession.CenterMode == ARSession.ARCenterMode.SpecificTarget . Modify at any time and takes effect immediately.
The object must contain one of the following component: TargetController , SparseSpatialMapRootController or SpatialMapRootController .
CenterObject¶
- C#
public GameObject CenterObject { get; }
Center object this session is using in current frame.
This object represents an object or parent of object that do not move in Unity space. It can be ARSession.Origin , ARAssembly.Camera or some target. A target could be object containing one of the following component: TargetController , SparseSpatialMapRootController or SpatialMapRootController . While in the context of sparse spatial map or cloud spatial map, the exact center GameObject is the localized map object under the root, and ARSession.CenterObject is parent of this object. See description of ARSession.ARCenterMode for more details.
Assembly¶
- C#
public ARAssembly Assembly { get; }
Assembly of AR components.
FrameCameraParameters¶
- C#
public Optional< CameraParameters > FrameCameraParameters { get; }
CameraParameters from current frame.
AvailableCenterMode¶
- C#
public IReadOnlyList< ARSession.ARCenterMode > AvailableCenterMode { get; }
Available center mode in the session.
Origin¶
- C#
public GameObject Origin { get; }
Origin of session when one type of motion tracking is running.
TrackingStatus¶
- C#
public Optional< MotionTrackingStatus > TrackingStatus { get; }
Tracking status when one type of motion tracking is running.
State¶
- C#
public ARSession.SessionState State { get; }
The state of current session.
Delegates¶
FrameChangeAction¶
- C#
public delegate void FrameChangeAction( OutputFrame outputFrame, Quaternion displayCompensation)
Output frame change event delegate.
Events¶
FrameChange¶
- C#
public event ARSession.FrameChangeAction FrameChange
Output frame change event. It is triggered when the data itself changes, the frequency is affected by FrameSource data change (like CameraDevice FPS).
FrameUpdate¶
- C#
public event Action< OutputFrame > FrameUpdate
Output frame update event. It has the same frequency as MonoBehaviour Update.
StateChanged¶
- C#
public event Action< ARSession.SessionState > StateChanged
ARSession.State change event.
Methods¶
ImageCoordinatesFromScreenCoordinates¶
Transforms points from screen coordinate system ([0, 1]^2) to image coordinate system ([0, 1]^2). pointInView should be normalized to [0, 1]^2.