Beispiel #1
0
        void OnGUI()
        {
            IEnumerable <ARPlaneAnchorGameObject> arpags = unityARAnchorManager.GetCurrentPlaneAnchors();

            foreach (var planeAnchor in arpags)
            {
                //ARPlaneAnchor ap = planeAnchor;
                //GUI.Box (new Rect (100, 100, 800, 60), string.Format ("Center: x:{0}, y:{1}, z:{2}", ap.center.x, ap.center.y, ap.center.z));
                //GUI.Box(new Rect(100, 200, 800, 60), string.Format ("Extent: x:{0}, y:{1}, z:{2}", ap.extent.x, ap.extent.y, ap.extent.z));
            }
        }
Beispiel #2
0
 private void GetActiveAnchors()
 {
     foreach (ARPlaneAnchorGameObject arpag in anchorManager.GetCurrentPlaneAnchors())
     {
         planeAnchors.Add(arpag);
     }
 }
Beispiel #3
0
        bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes)
        {
            List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes);

            if (hitResults.Count > 0)
            {
                foreach (var hitResult in hitResults)
                {
                    Debug.Log("Got hit!");
                    IEnumerable <ARPlaneAnchorGameObject> anchObjs = anchorManager.GetCurrentPlaneAnchors();
                    foreach (var planeAnchor in anchObjs)
                    {
                        if (planeAnchor.ToString() == hitResult.anchorIdentifier)
                        {
                            var gameObj = planeAnchor.gameObject;
                            debugtext.text = gameObj.GetComponent <Renderer>().bounds.ToString();
                        }
                    }
                    m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform);
                    //debugtext.text = hitResult.anchorIdentifier;
                    m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform);
                    //Debug.Log (string.Format ("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z));
                    return(true);
                }
            }
            return(false);
        }
 public void ARFrameUpdated(UnityARCamera camera)
 {
     foreach (ARPlaneAnchorGameObject arpag in unityARAnchorManager.GetCurrentPlaneAnchors())
     {
         MainLight.transform.position = arpag.gameObject.transform.position;
     }
 }
Beispiel #5
0
        void OnGUI()
        {
            List <ARPlaneAnchorGameObject> arpags = unityARAnchorManager.GetCurrentPlaneAnchors();

            if (arpags.Count >= 1)
            {
                HUDController  controller     = GameObject.Find("HUD").GetComponent <HUDController> ();
                GameController gameController = GameObject.Find("GameController").GetComponent <GameController> ();

                if (!GameController.gameStarted)
                {
                    controller.EnablePlayButton();
                    gameController.plane = arpags [0].gameObject;

                    if (controller.trackingPhaseText.enabled)
                    {
                        controller.trackingPhaseText.text = "Okay, we found a plane! Are you ready?";
                    }
                }

                //ARPlaneAnchor ap = arpags [0].planeAnchor;
                //GUI.Box (new Rect (100, 100, 800, 60), string.Format ("Center: x:{0}, y:{1}, z:{2}", ap.center.x, ap.center.y, ap.center.z));
                //GUI.Box(new Rect(100, 200, 800, 60), string.Format ("Extent: x:{0}, y:{1}, z:{2}", ap.extent.x, ap.extent.y, ap.extent.z));
            }
        }
 void OnGUI() {
     List<ARPlaneAnchorGameObject> arpags = unityARAnchorManager.GetCurrentPlaneAnchors();
     if (arpags.Count >= 1) {
         //ARPlaneAnchor ap = arpags [0].planeAnchor;
         //GUI.Box (new Rect (100, 100, 800, 60), string.Format ("Center: x:{0}, y:{1}, z:{2}", ap.center.x, ap.center.y, ap.center.z));
         //GUI.Box(new Rect(100, 200, 800, 60), string.Format ("Extent: x:{0}, y:{1}, z:{2}", ap.extent.x, ap.extent.y, ap.extent.z));
     }
 }
Beispiel #7
0
        private void OnGUI()
        {
            List <ARPlaneAnchorGameObject> currentPlaneAnchors = unityARAnchorManager.GetCurrentPlaneAnchors();

            if (currentPlaneAnchors.Count < 1)
            {
            }
        }
Beispiel #8
0
 private void GetActiveAnchors()
 {
     foreach (ARPlaneAnchorGameObject arpag in anchorManager.GetCurrentPlaneAnchors())
     {
         planeAnchors.Add(arpag);
     }
     amountOfObjectsInList = planeAnchors.Count;
     bluePlaneSize         = planeAnchors [amountOfObjectsInList - 1].planeAnchor.extent;
 }
        void OnGUI()
        {
            List <ARPlaneAnchorGameObject> arpags = unityARAnchorManager.GetCurrentPlaneAnchors();

            if (arpags.Count >= 1)
            {
                UIPanels.Instance.configScreens.SetState(ConfigScreens.states.TOUCH_TO_CREATE);
                return;
                //ARPlaneAnchor ap = arpags [0].planeAnchor;
                //GUI.Box (new Rect (100, 100, 800, 60), string.Format ("Center: x:{0}, y:{1}, z:{2}", ap.center.x, ap.center.y, ap.center.z));
                //GUI.Box(new Rect(100, 200, 800, 60), string.Format ("Extent: x:{0}, y:{1}, z:{2}", ap.extent.x, ap.extent.y, ap.extent.z));
            }
        }
        void CheckFirstPlane()
        {
            List <ARPlaneAnchorGameObject> arpags = unityARAnchorManager.GetCurrentPlaneAnchors();

            if (planeCount == 0 && arpags.Count > 0)
            {
                planeCount = arpags.Count;
                if (firstPlaneCreated != null)
                {
                    firstPlaneCreated.Invoke();
                }
            }
        }
Beispiel #11
0
        public void ShowTrackPlane(bool flag)
        {
            showTrackedPlane = flag;
            List <ARPlaneAnchorGameObject> arpags = unityARAnchorManager.GetCurrentPlaneAnchors();

            foreach (ARPlaneAnchorGameObject p in arpags)
            {
                MeshRenderer render = p.gameObject.GetComponentInChildren <MeshRenderer>();
                if (render != null)
                {
                    render.material = showTrackedPlane ? gridMat : shadowMat;
                }
            }
            MeshRenderer prefabRender = planePrefab.GetComponentInChildren <MeshRenderer>();

            prefabRender.material = showTrackedPlane ? gridMat : shadowMat;
        }