CompatibleAROriginFrameSource Class

Description

用于继承实现自定义frame source的抽象类。它可用于一个自身具有运动跟踪能力的设备或帧输入的frame source。它兼容提供多个Unity AR Foundation版本的支持,只有在你的设备SDK是基于Unity AR Foundation的时候才能使用。

参见 CompatibleVROriginFrameSourceExternalDeviceMotionFrameSourceWorldOriginBasedFrameSourceRelativeOriginBasedFrameSource

这个frame source是一种运动跟踪设备,在 ARSession 中会输出运动数据。


MonoBehaviour Messages

protected override void Awake()

protected virtual void OnDestroy()

protected virtual void OnApplicationPause(bool pause)

protected virtual void OnEnable()

protected virtual void OnDisable()


Properties

ARSessionOrigin

C#

public UnityEngine.XR.ARFoundation.ARSessionOrigin ARSessionOrigin { get; set; }

相机运动的相对物体,如果没设置,将会自动从场景中获取。

Origin

C#

public override GameObject Origin { get; }

ARSession 的原点,如果frame source可以输出运动跟踪数据。

每种运动跟踪frame source都有自己的方法来设置包含特定组件的原点物体。如果原点未设置,一些frame source会从场景中active的物体中自动选择可以使用的物体或创建一个新的物体。

XROrigin

C#

public Unity.XR.CoreUtils.XROrigin XROrigin { get; set; }

XR Origin。

AvailableCenterMode

C#

public override IReadOnlyList< ARSession.ARCenterMode > AvailableCenterMode { get; }

该frame source可以使用的中心模式。

ReceivedFrameCount

C#

public int ReceivedFrameCount { get; protected set; }

从设备获取到的帧计数。通常在debug中使用。如果这个数值停止增长,通常是硬件问题,某些设备(比如Nreal)重新插拔可能能解决。

IsAvailable

C#

public virtual abstract Optional<bool> IsAvailable { get; }

当前frame source是否可用。

如果数值等于null,需要调用 FrameSource.CheckAvailability ,数值将在 Coroutine 结束后可以访问。这个属性会在 ARComponentPicker 选择frame source的时候使用。

Camera

C#

public virtual Camera Camera { get; set; }

在一个 ARSession 中被该frame source使用的 Camera

每种frame source都有自己的方法来检查camera是否可用,设置不可用的camera将会被拒绝。这个属性会在 ARComponentPicker 选择frame source时用来判断frame source是否可用。在这个过程中,如果数值没有设置,一些frame source会从场景中active的物体中自动选择可以使用的 Camera 。你可以在session start前设置可用的 Camera 。如果这个frame source被 ARSession 选用,这个数值将在session ready后无法修改。


Methods

CheckAvailability

C#

public virtual System.Collections.IEnumerator CheckAvailability()

FrameSource.IsAvailable 等于null时用于检查frame source是否可用的 Coroutine