private void AddToDatabase(NRTrackableImage image, IARAnchor anchor) { if (!_database.ContainsKey(image.GetDataBaseIndex())) { _database.Add(image.GetDataBaseIndex(), anchor.ID); } }
private void DetectedUpdateAnchor(NRTrackableImage image) { IARAnchor anchor = GetOrCreateARAnchor(image); UpdateAnchorLocation(anchor, image.GetCenterPose()); OnUpdateAnchorPosition?.Invoke(anchor, CreateEventData(image)); }
private void AddAnchor(IARAnchor anchor) { if (_database.ContainsKey(anchor.ID)) { return; } _database.Add(anchor.ID, anchor); }
private void AddToDatabase(MLMarkerTrackerArgs args, IARAnchor anchor) { string markerID = GetMarkerID(args); if (!_database.ContainsKey(markerID)) { _database.Add(markerID, anchor.ID); } }
private void DetectedAnchor() { if (int.TryParse(_idStr, out int index)) { IARAnchor anchor = CreateARAnchor(); string id = _markerIDSolver.Solve(index); _database.Add(id, anchor); FireDetectedEvent(anchor, 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)); }
IARAnchor IARAnchorRepository.Create(AnchorID anchorID) { IARAnchor anchor = Find(anchorID); if (anchor == null) { anchor = _factory.Create(anchorID); } return(anchor); }
private void FireDetectedEvent(IARAnchor anchor, string id) { Debug.Log($"Detected an anchor with {id}"); SetAnchorLocation(anchor); OnDetectAnchorFirst?.Invoke(anchor, new ARMarkerEventData { ID = id, Name = $"EditorTrackableImage-[{id}]", }); }
private void DetectedNewAnchor(MLMarkerTrackerArgs args) { string markerID = GetMarkerID(args); Debug.Log($"Detected new marker [{markerID}]"); IARAnchor anchor = GetOrCreateARAnchor(args); UpdateAnchorLocation(anchor, args.Result.Position, args.Result.Rotation); OnDetectAnchorFirst?.Invoke(anchor, CreateEventData(args)); }
private void FireDetectedEvent(IARAnchor anchor) { SetAnchorLocation(anchor); string id = _markerIDSolver.Solve(_index++); OnDetectAnchorFirst?.Invoke(anchor, new ARMarkerEventData { ID = id, Name = $"EditorTrackableImage-[{id}]", }); }
private void DetectedUpdatedImage(ARTrackedImage image) { if (!_database.ContainsKey(image.name)) { return; } IARAnchor anchor = GetOrCreateARAnchor(image); UpdateAnchorLocation(anchor, image.transform); OnUpdateAnchorPosition?.Invoke(anchor, CreateEventData(image)); }
private bool TryGetARAnchor(MLMarkerTrackerArgs args, out IARAnchor anchor) { AnchorID anchorID; string markerID = GetMarkerID(args); if (_database.TryGetValue(markerID, out anchorID)) { anchor = _anchorService.Find(anchorID); return(true); } anchor = null; return(false); }
private void DetectedNewImage(ARTrackedImage image) { if (_database.ContainsKey(image.name)) { return; } Debug.Log($"Detected new image {image.name}"); IARAnchor anchor = GetOrCreateARAnchor(image); UpdateAnchorLocation(anchor, image.transform); OnDetectAnchorFirst?.Invoke(anchor, CreateEventData(image)); }
private IARAnchor GetOrCreateARAnchor(ARTrackedImage image) { IARAnchor anchor = null; AnchorID id; if (!_database.TryGetValue(image.name, out id)) { anchor = _anchorService.Find(id); } if (anchor == null) { anchor = _anchorService.Create(); AddIDToDatabase(image.name, anchor.ID); } return(anchor); }
private void HandleOnUpdateAnchorPosition(IARAnchor anchor, ARMarkerEventData eventdata) { if (eventdata.ID != _targetName) { return; } if (anchor == null) { return; } _hasARAnchor = true; _arAnchor = anchor; UpdatePose(); _markerDetector.OnUpdateAnchorPosition -= HandleOnUpdateAnchorPosition; }
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); }
private void HandleDetectAnchorFirst(IARAnchor anchor, ARMarkerEventData eventData) { AddPCA(anchor.Transform, eventData.ID); }
private void UpdateAnchorLocation(IARAnchor anchor, Transform target) { anchor.SetPositionAndRotation(target.position, target.rotation); }
private void UpdateAnchorLocation(IARAnchor anchor, Pose pose) { anchor.SetPositionAndRotation(pose.position, pose.rotation); }
private void UpdateAnchorLocation(IARAnchor anchor, Vector3 position, Quaternion rotation) { anchor.SetPositionAndRotation(position, rotation); }
private void SetAnchorLocation(IARAnchor anchor) { anchor.SetPositionAndRotation(_targetTrans.position, _targetTrans.rotation); }
private void HandleUpdateAnchorPosition(IARAnchor anchor, ARMarkerEventData eventdata) { transform.SetPositionAndRotation(anchor.Position, anchor.Rotation); }
private void HandleDetectAnchorFirst(IARAnchor anchor, ARMarkerEventData eventdata) { transform.SetPositionAndRotation(anchor.Position, anchor.Rotation); }
private void SetAnchorLocation(IARAnchor anchor) { anchor.SetPositionAndRotation(_origin, Quaternion.Euler(_euler)); }
private void DetectedAnchor() { IARAnchor anchor = CreateARAnchor(); FireDetectedEvent(anchor); }