private void AddToDatabase(NRTrackableImage image, IARAnchor anchor) { if (!_database.ContainsKey(image.GetDataBaseIndex())) { _database.Add(image.GetDataBaseIndex(), anchor.ID); } }
private ARMarkerEventData CreateEventData(NRTrackableImage image) { string id = _markerIDSolver.Solve(image.GetDataBaseIndex()); return(new ARMarkerEventData { ID = id, Name = $"NRTrackableImage-[{id}]", }); }
private void DetectedNewAnchor(NRTrackableImage image) { Debug.Log($"Detected new anchor with id {image.GetDataBaseIndex()}"); IARAnchor anchor = GetOrCreateARAnchor(image); UpdateAnchorLocation(anchor, image.GetCenterPose()); OnDetectAnchorFirst?.Invoke(anchor, CreateEventData(image)); }
private IARAnchor GetOrCreateARAnchor(NRTrackableImage image) { IARAnchor anchor = null; AnchorID id; int index = image.GetDataBaseIndex(); if (!_database.TryGetValue(index, out id)) { anchor = _anchorService.Find(id); } if (anchor == null) { anchor = _anchorService.Create(); AddToDatabase(image, anchor); } return(anchor); }