//移动 public void MoveObject(Touch touch) { if (touch.phase == TouchPhase.Began) { arObjectTracker.StopAR(); _beginMovePosition = new Vector3(touch.position.x, touch.position.y, 0); } if (touch.phase == TouchPhase.Moved) { Vector3 objPos = Camera.main.WorldToScreenPoint(_target.transform.position); Vector3 pos = new Vector3(touch.position.x, touch.position.y, 0) - _beginMovePosition; objPos += pos; _target.transform.position = Camera.main.ScreenToWorldPoint(objPos); _beginMovePosition = new Vector3(touch.position.x, touch.position.y, 0); } if (touch.phase == TouchPhase.Ended) { _arObjectTrackle.UpdateSlamPos(); arObjectTracker.StartAR(); } }
public void ButtonOnClick(string name, int count) { if (objectTracker.activeSelf && imageName != name) { tracker.StopAR(); for (int i = 0; i < objectTracker.transform.childCount; i++) { objectTracker.transform.GetChild(i).gameObject.SetActive(false); } text.text = ""; } if (!message.gameObject.activeSelf) { message.gameObject.SetActive(true); } message.text = "请正对" + name + "后,点击拍照识别按钮"; imageName = name; index = count; scrollRect.horizontalNormalizedPosition = exampleScrollView.offsets[count]; }