コード例 #1
0
 private void Awake()
 {
     m_interface = ARKInterface.GetInterface();
     if (m_interface == null)
     {
         Destroy(this);
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns the currently used interface.
        /// If no interface has been specified, creates the correct one depending on the device.
        /// </summary>
        public static ARKInterface GetInterface()
        {
            if (m_interface == null)
            {
                //TODO: SPECIFIC INTERFACES, FACTORY REFACTO?

                #if UNITY_IOS
                m_interface = new ARK_ARKit();
                #endif
//                #if UNITY_EDITOR
//                    m_Interface = new AREditorInterface();
//                #elif UNITY_IOS
//                    m_Interface = new ARKitInterface();
//                #elif UNITY_ANDROID
//                    m_Interface = new ARCoreInterface();
//                #endif
            }

            return(m_interface);
        }
コード例 #3
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);
                }
            }
        }
コード例 #4
0
 //TODO: DOC, is this method useless?
 public static void SetInterface(ARKInterface _interface)
 {
     m_interface = _interface;
 }
コード例 #5
0
ファイル: ARKController.cs プロジェクト: RBSpooklight/ARK
 protected virtual void SetupARInterface()
 {
     m_interface = ARKInterface.GetInterface();
 }