BasePoseProvider.cs
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if ENABLE_VR || ENABLE_AR
using UnityEngine.XR;
using UnityEngine.SpatialTracking;
namespace UnityEngine.Experimental.XR.Interaction
{
/// <summary>
/// The BasePoseProvider type is used as the base interface for all "Pose Providers"
/// Implementing this abstract class will allow the Pose Provider to be linked to a Tracked Pose Driver.
/// </summary>
[Serializable]
public abstract class BasePoseProvider : MonoBehaviour
{
/// <summary> Gets the Pose value from the Pose Provider. returns NoData as this is a default implementation. Specializations will return the correct bitflags relating to the Pose data they are returning</summary>
public virtual PoseDataFlags GetPoseFromProvider(out Pose output)
{
// disabling the obsolete warning/error here so that no error is generated by the use of this function.
#pragma warning disable 618,619
if(TryGetPoseFromProvider(out output))
{
return PoseDataFlags.Position | PoseDataFlags.Rotation;
}
#pragma warning restore 618,619
return PoseDataFlags.NoData;
}
/// <summary>
/// This function is provided for backwards compatibiltiy with the BasePoseProvider found in com.untiy.xr.legacyinputhelpers v1.3.X
/// Please do not implement this function, instead use the new API via GetPoseFromProvider
/// </summary>
[System.Obsolete("This function is provided for backwards compatibiltiy with the BasePoseProvider found in com.untiy.xr.legacyinputhelpers v1.3.X Please do not implement this function, instead use the new API via GetPoseFromProvider",false)]
public virtual bool TryGetPoseFromProvider(out Pose output)
{
output = Pose.identity;
return false;
}
}
}
#endif