示例#1
0
        /// <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);
        }
示例#2
0
        private void DetectedUpdateAnchor(NRTrackableImage image)
        {
            IARAnchor anchor = GetOrCreateARAnchor(image);

            UpdateAnchorLocation(anchor, image.GetCenterPose());

            OnUpdateAnchorPosition?.Invoke(anchor, CreateEventData(image));
        }
示例#3
0
        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));
        }
示例#4
0
    // 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);
    }
示例#5
0
 public void Update()
 {
     // Want the imperfect image tracking here
     if (Image == null /*|| Image.GetTrackingState() != TrackingState.Tracking*/)
     {
         // Cube.SetActive(false);
         return;
     }
     else
     {
         var imageCenter = Image.GetCenterPose();
         // same as Start()
         Instantiate(Cube, imageCenter.position, imageCenter.rotation);
         Destroy(gameObject);
         //transform.position = imageCenter.position + new Vector3(0, 0, 2f);
         //transform.rotation = imageCenter.rotation;
         //Cube.SetActive(true);
         return;
     }
 }