示例#1
0
        public static GameObject ARScreencast(Vector2 screenPoint, GameObject reactPrefab, bool shallAnchor = false)
        {
            TrackableHit hit;
            Camera       camera = ARControl.main.FirstPersonCamera;

            if (!camera)
            {
                camera = ARControl.main.FirstPersonCamera = Camera.main;
            }
            if (ARControl.trackCast(screenPoint, camera.transform, out hit))
            {
                //TODO: not Andy, duh
                GameObject go = Instantiate(reactPrefab);
                go.transform.position = hit.Pose.position;
                if (shallAnchor)
                {
                    Anchor anchor = hit.Trackable.CreateAnchor(hit.Pose);
                    go.transform.SetParent(anchor.transform, true);
                }

                return(go);
            }
            return(null);
        }
示例#2
0
 private void Awake()
 {
     main = this;
 }