예제 #1
0
        public void GetAnchors(List <NRWorldAnchor> anchorlist)
        {
            if (anchorlist == null)
            {
                Debug.LogError("Anchor list can not be null!");
                return;
            }
            anchorlist.Clear();

            var listhandle = NativeMapping.CreateAnchorList();
            var size       = NativeMapping.GetAnchorListSize(listhandle);

            for (int i = 0; i < size; i++)
            {
                var           anchorhandle = NativeMapping.AcquireItem(listhandle, i);
                NRWorldAnchor anchor       = null;
                m_AnchorDict.TryGetValue(anchorhandle, out anchor);
                if (anchor == null)
                {
                    anchor = CreateAnchor(anchorhandle);
                    m_AnchorDict.Add(anchorhandle, anchor);
                }
                anchorlist.Add(anchor);
            }
            anchorlist.AddRange(AnchorAddList);
            NativeMapping.DestroyAnchorList(listhandle);
        }
예제 #2
0
        public void AddAnchor(Pose worldPose)
        {
            var handle = NativeMapping.AddAnchor(worldPose);

            if (handle == 0)
            {
                Debug.LogError("Add anchor failed anchor handle:" + handle);
                return;
            }
            NRWorldAnchor anchor = null;

            m_AnchorDict.TryGetValue(handle, out anchor);
            if (anchor == null)
            {
                anchor = CreateAnchor(handle);
                m_AnchorDict.Add(handle, anchor);
            }
            AnchorAddList.Add(anchor);
        }
예제 #3
0
        private NRWorldAnchor CreateAnchor(UInt64 handle)
        {
            NRWorldAnchor anchor = new NRWorldAnchor(handle, NativeMapping);

            return(anchor);
        }