Esempio n. 1
0
 private void Awake()
 {
     m_interface = ARKInterface.GetInterface();
     if (m_interface == null)
     {
         Destroy(this);
     }
 }
Esempio n. 2
0
        void Update()
        {
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
            {
                var camera    = GetCamera();
                var ray       = camera.ScreenPointToRay(Input.GetTouch(0).position);
                var layerMask = 1 << LayerMask.NameToLayer("ARObject");

                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, float.MaxValue, layerMask))
                {
                    GameObject go = Instantiate(m_objectToPlace, root);
                    go.transform.position = hit.point;

                    var pose = new Pose();
                    ARKInterface.GetInterface().TryGetPose(ref pose);

                    var relativePos = pose.position - hit.point;
                    go.transform.rotation = Quaternion.LookRotation(relativePos);
                }
            }
        }
Esempio n. 3
0
 protected virtual void SetupARInterface()
 {
     m_interface = ARKInterface.GetInterface();
 }