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); }
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); }
private NRWorldAnchor CreateAnchor(UInt64 handle) { NRWorldAnchor anchor = new NRWorldAnchor(handle, NativeMapping); return(anchor); }