/// <summary> Updates this object. </summary> public void Update() { if (Image == null || Image.GetTrackingState() != TrackingState.Tracking) { FrameLowerLeft.SetActive(false); FrameLowerRight.SetActive(false); FrameUpperLeft.SetActive(false); FrameUpperRight.SetActive(false); Axis.SetActive(false); return; } float halfWidth = Image.ExtentX / 2; float halfHeight = Image.ExtentZ / 2; FrameLowerLeft.transform.localPosition = (halfWidth * Vector3.left) + (halfHeight * Vector3.back); FrameLowerRight.transform.localPosition = (halfWidth * Vector3.right) + (halfHeight * Vector3.back); FrameUpperLeft.transform.localPosition = (halfWidth * Vector3.left) + (halfHeight * Vector3.forward); FrameUpperRight.transform.localPosition = (halfWidth * Vector3.right) + (halfHeight * Vector3.forward); var center = Image.GetCenterPose(); transform.position = center.position; transform.rotation = center.rotation; FrameLowerLeft.SetActive(true); FrameLowerRight.SetActive(true); FrameUpperLeft.SetActive(true); FrameUpperRight.SetActive(true); Axis.SetActive(true); }
private void Update() { if (m_DetectedMarker != null && m_DetectedMarker.GetTrackingState() == TrackingState.Tracking) { Vector2 size = m_DetectedMarker.Size; transform.localScale = new Vector3(size.x, transform.localScale.y, size.y); } }
// Update is called once per frame void Update() { // if image tracker not found if (pageFlower == null || pageFlower.GetTrackingState() != TrackingState.Tracking) { // do not display scene sceneFlower.SetActive(false); return; } // if found, set position var center = pageFlower.GetCenterPose(); transform.position = center.position; transform.rotation = center.rotation; // display scene sceneFlower.SetActive(true); }