Пример #1
0
        public static MRReferencePoint ToMRReferencePoint(this ARReferencePoint point)
        {
            var mrReferencePoint = new MRReferencePoint
            {
                id   = point.trackableId.ToMarsId(),
                pose = point.transform.GetLocalPose()
            };

            switch (point.trackingState)
            {
            case TrackingState.Tracking:
                mrReferencePoint.trackingState = MARSTrackingState.Tracking;
                break;

            case TrackingState.Limited:
                mrReferencePoint.trackingState = MARSTrackingState.Limited;
                break;

            default:
                mrReferencePoint.trackingState = MARSTrackingState.Unknown;
                break;
            }

            return(mrReferencePoint);
        }
        public bool TryGetReferencePoint(MarsTrackableId id, out MRReferencePoint referencePoint)
        {
            ARReferencePoint arReferencePoint;

            if (!k_TrackableIds.TryGetValue(id, out arReferencePoint) || m_ARReferencePointManager == null)
            {
                referencePoint = default(MRReferencePoint);
                return(false);
            }

#if ARFOUNDATION_3_0_1_OR_NEWER
            var result = m_ARReferencePointManager.GetAnchor(arReferencePoint.trackableId);
#else
            var result = m_ARReferencePointManager.GetReferencePoint(arReferencePoint.trackableId);
#endif
            referencePoint = result.ToMRReferencePoint();
            return(true);
        }
        public void AddMARSReferencePointData()
        {
            var point1 = new MRReferencePoint(new Pose(Vector3.right, Quaternion.identity));

            point1.id = MarsTrackableId.Create();
            var point2 = new MRReferencePoint(new Pose(Vector3.up, Quaternion.identity));

            point2.id = MarsTrackableId.Create();

            // this will probably need to change when we change how we generate IDs
            var marsDataId1 = m_Db.referencePointData.AddOrUpdateData(point1);
            var marsDataId2 = m_Db.referencePointData.AddOrUpdateData(point2);

            m_Db.referencePointData.GetAllData(m_TempReferencePoints);
            Assert.AreEqual(2, m_TempReferencePoints.Count);

            Assert.True(m_TempReferencePoints.TryGetValue(marsDataId1, out point1));
            Assert.True(m_TempReferencePoints.TryGetValue(marsDataId2, out point1));
        }
 public bool TryGetReferencePoint(MarsTrackableId id, out MRReferencePoint referencePoint)
 {
     throw new NotImplementedException();
 }
Пример #5
0
 /// <summary>
 /// Get a reference point
 /// </summary>
 /// <returns>true if getting the point succeeded, false otherwise</returns>
 public static bool TryGetReferencePoint(this IUsesReferencePoints obj, MarsTrackableId referencePointId, out MRReferencePoint point)
 {
     return(obj.provider.TryGetReferencePoint(referencePointId, out point));
 }