Esempio n. 1
0
    /// <summary>
    /// Gets a target from a ray.
    /// </summary>
    /// <param name="isRailgunShot">Determines if the shot is a railgun shot.</param>
    /// <returns>Returns the position that the ray hit the object.</returns>
    private Vector3 GetTarget(bool isRailgunShot = false)
    {
        Ray ray;

        // if the shot is a railgun shot then use a straight ray from the camera as the ray
        if (isRailgunShot)
        {
            ray = RectTransformUtility.ScreenPointToRay(Camera.main, Camera.main.pixelRect.center);
        }
        // if the shot is a shotgun shot then get a random position within the spread extents for the ray origin
        else
        {
            // creates a random offset to apply to the camera origin
            Vector2 offset = new Vector2
            {
                x = UnityEngine.Random.Range(-m_spreadShotExtents, m_spreadShotExtents),
                y = UnityEngine.Random.Range(-m_spreadShotExtents, m_spreadShotExtents)
            };

            ray = RectTransformUtility.ScreenPointToRay(Camera.main, Camera.main.pixelRect.center + offset);
        }

        RaycastHit raycastHit;

        // stores the hit information from the ray in the raycast hit object
        Physics.Raycast(ray, out raycastHit, collidableLayers);
        return(raycastHit.point);
    }
Esempio n. 2
0
        private void Update()
        {
            if (fireball != null)
            {
                AnimatorStateInfo  animationState = animator.GetCurrentAnimatorStateInfo(0);
                AnimatorClipInfo[] myAnimatorClip = animator.GetCurrentAnimatorClipInfo(0);
                if (myAnimatorClip[0].clip.name == "Throw")
                {
                    float myTime = myAnimatorClip[0].clip.length * animationState.normalizedTime;
                    if (myTime >= 0.9f)
                    {
                        Ray     ray    = RectTransformUtility.ScreenPointToRay(Camera.main, reticle.position);
                        Vector3 lookAt = ray.origin + Camera.main.transform.forward * 3;

                        fireball.gameObject.SetActive(false);
                        fireball.transform.position = fireball.transform.position + (fireball.transform.right * 1.0f);
                        fireball.transform.SetParent(null);
                        fireball.transform.LookAt(ray.GetPoint(50));
                        Debug.DrawLine(ray.origin, ray.GetPoint(50));

                        DamageDealer dealer = fireball.GetComponentInChildren <DamageDealer>();
                        if (dealer != null)
                        {
                            dealer.overrideDamageSource = true;
                            dealer.damageSource         = statsCog.gameObject;
                        }

                        fireball.IsReleased = true;
                        fireball.gameObject.SetActive(true);
                        fireball = null;
                    }
                }
            }
        }
Esempio n. 3
0
        private Vector3 AxisPos(Vector2 _screenPos)
        {
            Vector3 position = ((Component)this).get_transform().get_position();
            Plane   plane;

            ((Plane) ref plane).\u002Ector(Vector3.op_Multiply(((Component)this.camera).get_transform().get_forward(), -1f), position);
            Ray     ray       = RectTransformUtility.ScreenPointToRay(this.camera, _screenPos);
            float   num       = 0.0f;
            Vector3 vector3_1 = Vector3.op_Subtraction(!((Plane) ref plane).Raycast(ray, ref num) ? position : ((Ray) ref ray).GetPoint(num), position);
            Vector3 vector3_2 = ((Component)this).get_transform().get_up();

            switch (this.axis)
            {
            case GuideScale.ScaleAxis.X:
                vector3_2 = Vector3.get_right();
                break;

            case GuideScale.ScaleAxis.Y:
                vector3_2 = Vector3.get_up();
                break;

            case GuideScale.ScaleAxis.Z:
                vector3_2 = Vector3.get_forward();
                break;
            }
            return(Vector3.Project(vector3_1, vector3_2));
        }
Esempio n. 4
0
        public static bool RaycastScreenPointToRay(Vector2 screenPoint, out RaycastHit hit, Camera camera = null)
        {
            camera = camera == null ? Camera.main : camera;
            Ray ray = RectTransformUtility.ScreenPointToRay(camera, screenPoint);

            return(Physics.Raycast(ray, out hit, Mathf.Infinity));
        }
Esempio n. 5
0
    private void Update()
    {
        Vector3 position = RectTransformUtility.ScreenPointToRay(Camera.main, Input.mousePosition).origin;

        position           = new Vector3(position.x, position.y, 0);
        transform.rotation = Quaternion.LookRotation(position - transform.position);
    }
Esempio n. 6
0
    public void OnPointerUp(PointerEventData data)
    {
        float distance = Vector2.Distance(DownPos, data.position);

        if (distance < 2)
        {
            Ray ray = RectTransformUtility.ScreenPointToRay(Camera.main, data.position);

            RaycastHit hitInfo;
            if (Physics.Raycast(ray, out hitInfo, Mathf.Infinity))
            {
                if (ShouldRespond(hitInfo.collider.gameObject))
                {
                    //Debug.Log("Raycast Hit at " + hitInfo.point);
                    OnRaycast.Invoke(hitInfo.point);
                }

                if (ShouldInterract(hitInfo.collider.gameObject))
                {
                    CanSearch     = true;
                    InterractName = hitInfo.collider.name;
                }
            }
        }
    }
Esempio n. 7
0
        public void OnDrag(PointerEventData eventData)
        {
            var ray = RectTransformUtility.ScreenPointToRay(mainCamera, eventData.position);

            if (Physics.Raycast(ray, out var hit))
            {
                target.position = hit.point + hit.normal * 0.5f;
            }
        }
        private Vector3 WorldPos(Vector2 _screenPos)
        {
            Plane plane;

            ((Plane) ref plane).\u002Ector(Vector3.op_Multiply(((Component)this.camera).get_transform().get_forward(), -1f), ((Component)this).get_transform().get_position());
            Ray   ray = RectTransformUtility.ScreenPointToRay(this.camera, _screenPos);
            float num = 0.0f;

            return(((Plane) ref plane).Raycast(ray, ref num) ? ((Ray) ref ray).GetPoint(num) : ((Component)this).get_transform().get_position());
        }
Esempio n. 9
0
        private Vector3 PlanePos(Vector2 _screenPos)
        {
            Plane plane;

            ((Plane) ref plane).\u002Ector(((Component)this).get_transform().get_up(), ((Component)this).get_transform().get_position());
            Ray   ray = RectTransformUtility.ScreenPointToRay(Camera.get_main(), _screenPos);
            float num = 0.0f;

            return(((Plane) ref plane).Raycast(ray, ref num) ? ((Ray) ref ray).GetPoint(num) : ((Component)this).get_transform().get_position());
        }
    static int ScreenPointToRay(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        Camera  arg0 = (Camera)LuaScriptMgr.GetUnityObject(L, 1, typeof(Camera));
        Vector2 arg1 = LuaScriptMgr.GetVector2(L, 2);
        Ray     o    = RectTransformUtility.ScreenPointToRay(arg0, arg1);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Esempio n. 11
0
        public static bool ScreenPointToWorldPointInRectangle(Transform transform, Vector2 screenPoint, Camera cam, out Vector3 worldPoint)
        {
            worldPoint = Vector2.zero;
            Ray ray = RectTransformUtility.ScreenPointToRay(cam, screenPoint);

            if (!new Plane(transform.rotation * Vector3.back, transform.position).Raycast(ray, out float enter))
            {
                return(false);
            }
            worldPoint = ray.GetPoint(enter);
            return(true);
        }
Esempio n. 12
0
    /// <summary>
    /// equals to <see cref="RectTransformUtility.ScreenPointToWorldPointInRectangle"/>
    /// </summary>
    /// ScreenPointToRay:cam.ScreenPointToRay explaination:http://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/raycast/sld008.htm
    public static Vector3 ScreenToWorldPointWithRay(
        this Camera camera, Vector2 screenPos, RectTransform rect)
    {
        Vector3 worldPoint = Vector3.zero;
        Ray     ray        = RectTransformUtility.ScreenPointToRay(camera, screenPos);
        float   enter;

        if (new Plane(rect.rotation * Vector3.back, rect.position).Raycast(ray, out enter))
        {
            worldPoint = ray.GetPoint(enter);
        }
        return(worldPoint);
    }
Esempio n. 13
0
        private Vector3 PlanePos(Vector2 _screenPos)
        {
            Plane plane;

            ((Plane) ref plane).\u002Ector(((Component)this).get_transform().get_right(), ((Component)this).get_transform().get_position());
            if (!((Plane) ref plane).GetSide(((Component)this.camera).get_transform().get_position()))
            {
                ((Plane) ref plane).SetNormalAndPosition(Vector3.op_Multiply(((Component)this).get_transform().get_right(), -1f), ((Component)this).get_transform().get_position());
            }
            Ray   ray = RectTransformUtility.ScreenPointToRay(this.camera, _screenPos);
            float num = 0.0f;

            return(((Plane) ref plane).Raycast(ray, ref num) ? ((Ray) ref ray).GetPoint(num) : ((Component)this).get_transform().get_position());
        }
Esempio n. 14
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            var        ray = RectTransformUtility.ScreenPointToRay(_mainCam, Input.mousePosition);
            RaycastHit hitInfo;
            if (Physics.Raycast(ray, out hitInfo))
            {
                _agent.SetDestination(hitInfo.point);
            }
        }

        IsDirty = _agent.velocity.sqrMagnitude > 0f;
    }
        private Vector3 AxisPos(Vector2 _screenPos)
        {
            Vector3 position = ((Component)this).get_transform().get_position();
            Plane   plane;

            ((Plane) ref plane).\u002Ector(((Component)this).get_transform().get_forward(), position);
            if (!((Plane) ref plane).GetSide(((Component)this.camera).get_transform().get_position()))
            {
                ((Plane) ref plane).\u002Ector(Vector3.op_Multiply(((Component)this).get_transform().get_forward(), -1f), position);
            }
            Vector3 up  = ((Component)this).get_transform().get_up();
            Ray     ray = RectTransformUtility.ScreenPointToRay(this.camera, _screenPos);
            float   num = 0.0f;

            return(((Plane) ref plane).Raycast(ray, ref num) ? Vector3.Project(((Ray) ref ray).GetPoint(num), up) : Vector3.Project(position, up));
        }
Esempio n. 16
0
        public static bool ScreenPointToWorldPointInRectangle(RectTransform rectTrans, Vector2 screenPoint, Camera cam, out Vector2 worldPoint)
        {
            worldPoint = Vector2.zero;
            Ray   ray = RectTransformUtility.ScreenPointToRay(cam, screenPoint);
            float enter;

            if (!new Plane(rectTrans.rotation * Vector3.back, rectTrans.position).Raycast(ray, out enter))
            {
                return(false);
            }

            worldPoint = ray.GetPoint(enter);
            worldPoint = rectTrans.worldToLocalMatrix.MultiplyPoint(worldPoint);
            LB2LT(ref worldPoint, rectTrans.rect.height);
            return(true);
        }
        public static bool ScreenPointToWorldPointInRectangle(this Camera cam, Vector3 planePosition, Quaternion planeRotation, Vector2 screenPoint, out Vector3 worldPoint)
        {
            worldPoint = Vector2.zero;
            Ray   ray   = RectTransformUtility.ScreenPointToRay(cam, screenPoint);
            Plane plane = new Plane(planeRotation * Vector3.back, planePosition);
            float distance;
            bool  result;

            if (!plane.Raycast(ray, out distance))
            {
                result = false;
            }
            else
            {
                worldPoint = ray.GetPoint(distance);
                result     = true;
            }
            return(result);
        }
Esempio n. 18
0
        private void Update()
        {
            if (Physics.Raycast(RectTransformUtility.ScreenPointToRay(Camera.main, caster.position), out RaycastHit hit))
            {
                if (hit.transform.gameObject.CompareTag("Player"))
                {
                    return;
                }

                StatsCog statsCog = hit.transform.gameObject.GetComponentInChildren <StatsCog>();
                if (statsCog == null)
                {
                    display.gameObject.SetActive(false);
                }
                else
                {
                    display.SetStatsCog(statsCog);
                    display.gameObject.SetActive(true);
                }
            }
        }
    public static int ScreenPointToRay_s(IntPtr l)
    {
        int result;

        try
        {
            Camera cam;
            LuaObject.checkType <Camera>(l, 1, out cam);
            Vector2 screenPos;
            LuaObject.checkType(l, 2, out screenPos);
            Ray ray = RectTransformUtility.ScreenPointToRay(cam, screenPos);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, ray);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
        public void SetupBodyPart(BodyPartController bpc)
        {
            BodyPartController flipped = Instantiate(bpc.gameObject, bpc.transform.parent).GetComponent <BodyPartController>();

            bpc.Flipped     = flipped;
            flipped.Flipped = bpc;

            flipped.gameObject.name = bpc.gameObject.name + "(Flipped)";
            if (bpc is LimbController)
            {
                LimbController limb = bpc as LimbController;

                limbs.Add(limb);
                limbs.Add(limb.FlippedLimb);
            }
            else
            {
                flipped.Model.localScale = new Vector3(-flipped.Model.localScale.x, flipped.Model.localScale.y, flipped.Model.localScale.z);
            }

            #region Interact
            UnityAction onPress = delegate
            {
                CreatureCreator.Instance.CameraOrbit.Freeze();

                bpc.transform.SetParent(Dynamic.Transform);
                flipped.transform.SetParent(Dynamic.Transform);

                bpc.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Ignore Raycast"), new List <string> {
                    "Tools"
                });
                flipped.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Ignore Raycast"), new List <string> {
                    "Tools"
                });
            };
            UnityAction onRelease = delegate
            {
                CreatureCreator.Instance.CameraOrbit.Unfreeze();

                DetachBodyPart(bpc);
                DetachBodyPart(flipped);

                if (Physics.Raycast(RectTransformUtility.ScreenPointToRay(CreatureCreator.Instance.CameraOrbit.Camera, Input.mousePosition), out RaycastHit raycastHit) && raycastHit.collider.CompareTag("Player"))
                {
                    AttachBodyPart(bpc);
                    AttachBodyPart(flipped);
                }
                else
                {
                    audioSource.PlayOneShot(poofAudioClip);
                    Instantiate(poofEffect, bpc.Drag.IsPressing ? bpc.transform.position : flipped.transform.position, Quaternion.identity, Dynamic.Transform);
                    RemoveFromStatistics(bpc.name);

                    if (bpc is LimbController)
                    {
                        LimbController limb = bpc as LimbController;

                        limbs.Remove(limb);
                        limbs.Remove(limb.FlippedLimb);
                    }

                    Destroy(bpc.gameObject);
                    Destroy(flipped.gameObject);
                }

                bpc.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Body"), new List <string> {
                    "Tools"
                });
                flipped.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Body"), new List <string> {
                    "Tools"
                });

                bpc.Drag.Plane = flipped.Drag.Plane = new Plane(Vector3.right, Vector3.zero);
            };
            UnityAction onDrag = delegate
            {
                if (Physics.Raycast(RectTransformUtility.ScreenPointToRay(CreatureCreator.Instance.CameraOrbit.Camera, Input.mousePosition), out RaycastHit raycastHit) && raycastHit.collider.CompareTag("Player"))
                {
                    bpc.Drag.Draggable = false;

                    bpc.transform.position = raycastHit.point;
                    bpc.transform.rotation = Quaternion.LookRotation(raycastHit.normal);

                    if (Mathf.Abs(bpc.transform.position.x) > settings.MergeThreshold)
                    {
                        flipped.gameObject.SetActive(true);
                        flipped.transform.position = new Vector3(-bpc.transform.position.x, bpc.transform.position.y, bpc.transform.position.z);
                        flipped.transform.rotation = Quaternion.Euler(bpc.transform.rotation.eulerAngles.x, -bpc.transform.rotation.eulerAngles.y, -bpc.transform.rotation.eulerAngles.z);
                    }
                    else
                    {
                        flipped.gameObject.SetActive(false);
                        bpc.transform.position = new Vector3(0, bpc.transform.position.y, bpc.transform.position.z);
                        bpc.transform.rotation = Quaternion.LookRotation(new Vector3(0, raycastHit.normal.y, raycastHit.normal.z));

                        if (bpc is LimbController)
                        {
                            foreach (Transform bone in (bpc as LimbController).Bones)
                            {
                                bone.position = new Vector3(0, bone.position.y, bone.position.z);
                            }
                        }
                    }
                }
                else
                {
                    bpc.Drag.Draggable = true;
                    flipped.gameObject.SetActive(false);
                }
            };
            UnityAction onFlippedDrag = delegate
            {
                if (Physics.Raycast(RectTransformUtility.ScreenPointToRay(CreatureCreator.Instance.CameraOrbit.Camera, Input.mousePosition), out RaycastHit raycastHit) && raycastHit.collider.CompareTag("Player"))
                {
                    flipped.Drag.Draggable = false;

                    flipped.transform.position = raycastHit.point;
                    flipped.transform.rotation = Quaternion.LookRotation(raycastHit.normal);

                    if (Mathf.Abs(flipped.transform.position.x) > settings.MergeThreshold)
                    {
                        bpc.gameObject.SetActive(true);
                        bpc.transform.position = new Vector3(-flipped.transform.position.x, flipped.transform.position.y, flipped.transform.position.z);
                        bpc.transform.rotation = Quaternion.Euler(flipped.transform.rotation.eulerAngles.x, -flipped.transform.rotation.eulerAngles.y, -flipped.transform.rotation.eulerAngles.z);
                    }
                    else
                    {
                        bpc.gameObject.SetActive(false);
                        flipped.transform.position = new Vector3(0, flipped.transform.position.y, flipped.transform.position.z);
                        flipped.transform.rotation = Quaternion.LookRotation(new Vector3(0, raycastHit.normal.y, raycastHit.normal.z));

                        if (bpc is LimbController)
                        {
                            foreach (Transform bone in (flipped as LimbController).Bones)
                            {
                                bone.position = new Vector3(0, bone.position.y, bone.position.z);
                            }
                        }
                    }
                }
                else
                {
                    flipped.Drag.Draggable = true;
                    bpc.gameObject.SetActive(false);
                }
            };

            bpc.Drag.OnPress.AddListener(onPress);
            bpc.Drag.OnDrag.AddListener(onDrag);
            bpc.Drag.OnRelease.AddListener(onRelease);
            flipped.Drag.OnPress.AddListener(onPress);
            flipped.Drag.OnDrag.AddListener(onFlippedDrag);
            flipped.Drag.OnRelease.AddListener(onRelease);
            #endregion
        }
Esempio n. 21
0
        /// <summary>
        /// Raises the webcam texture to mat helper error occurred event.
        /// </summary>
        /// <param name="errorCode">Error code.</param>
        //        public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
        //        {
        //            Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
        //        }

        // Update is called once per frame
        void Update()
        {
            if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
            {
                Mat rgbaMat = webCamTextureToMatHelper.GetMat();

                //convert image to greyscale
                Imgproc.cvtColor(rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);


                if (isAutoResetMode || faceTracker.getPoints().Count <= 0)
                {
                    //                                      Debug.Log ("detectFace");

                    //convert image to greyscale
                    using (var equalizeHistMat = new Mat())
                        using (var faces = new MatOfRect())
                        {
                            Imgproc.equalizeHist(grayMat, equalizeHistMat);

                            cascade.detectMultiScale(equalizeHistMat,
                                                     faces,
                                                     1.1f,
                                                     2,
                                                     0 | Objdetect.CASCADE_SCALE_IMAGE,
                                                     new OpenCVForUnity.Size(equalizeHistMat.cols() * 0.15,
                                                                             equalizeHistMat.cols() * 0.15),
                                                     new Size()
                                                     );

                            if (faces.rows() > 0)
                            {
                                //                          Debug.Log ("faces " + faces.dump ());

                                List <OpenCVForUnity.Rect> rectsList  = faces.toList();
                                List <Point[]>             pointsList = faceTracker.getPoints();

                                if (isAutoResetMode)
                                {
                                    //add initial face points from MatOfRect
                                    if (pointsList.Count <= 0)
                                    {
                                        faceTracker.addPoints(faces);
                                        //                                  Debug.Log ("reset faces ");
                                    }
                                    else
                                    {
                                        for (int i = 0; i < rectsList.Count; i++)
                                        {
                                            var trackRect = new OpenCVForUnity.Rect(rectsList [i].x + rectsList [i].width / 3, rectsList [i].y + rectsList [i].height / 2, rectsList [i].width / 3, rectsList [i].height / 3);
                                            //It determines whether nose point has been included in trackRect.
                                            if (i < pointsList.Count && !trackRect.contains(pointsList [i] [67]))
                                            {
                                                rectsList.RemoveAt(i);
                                                pointsList.RemoveAt(i);
                                                //                                          Debug.Log ("remove " + i);
                                            }
                                            Imgproc.rectangle(rgbaMat, new Point(trackRect.x, trackRect.y), new Point(trackRect.x + trackRect.width, trackRect.y + trackRect.height), new Scalar(0, 0, 255, 255), 2);
                                        }
                                    }
                                }
                                else
                                {
                                    faceTracker.addPoints(faces);
                                }

                                // ターゲットメッシュのリストを更新
                                {
                                    while (targetMeshList.Count < rectsList.Count)
                                    {
                                        var obj = Instantiate(targetMeshPrefab).GetComponent <MeshRenderer>();
                                        obj.transform.rotation = Quaternion.Euler(-90, 0, 0);
                                        targetMeshList.Add(obj);
                                    }

                                    for (int i = targetMeshList.Count - 1; i >= 0; --i)
                                    {
                                        if (i >= rectsList.Count)
                                        {
                                            targetMeshList[i].material.color = Color.clear;
                                        }
                                        else
                                        {
                                            targetMeshList[i].material.color = Color.red;
                                        }
                                    }
                                }

                                //draw face rect
                                for (int i = 0; i < rectsList.Count; i++)
                                {
                                                                #if OPENCV_2
                                    Core.rectangle(rgbaMat, new Point(rectsList [i].x, rectsList [i].y), new Point(rectsList [i].x + rectsLIst [i].width, rectsList [i].y + rectsList [i].height), new Scalar(255, 0, 0, 255), 2);
                                                                #else
                                    Imgproc.rectangle(rgbaMat, new Point(rectsList [i].x, rectsList [i].y), new Point(rectsList [i].x + rectsList [i].width, rectsList [i].y + rectsList [i].height), new Scalar(255, 0, 0, 255), 2);
                                                                #endif

                                    if (i < targetMeshList.Count)

                                    {
                                        var rectPos = new Vector2(rectsList[i].x, rectsList[i].y);

                                        // targetMeshList[i].transform.position = new Vector3( rectsList[i].x, rectsList[i].y, targetMeshPosZ );

                                        var        ray = RectTransformUtility.ScreenPointToRay(Camera.main, rectPos);
                                        RaycastHit hit;
                                        if (Physics.Raycast(ray, out hit))
                                        {
                                            targetMeshList[i].transform.position = hit.point + hit.normal * 0.5f;
                                        }

                                        targetImage.transform.localPosition = new Vector2(rectsList[i].x, rectsList[i].y);
                                    }
                                }
                            }
                            else
                            {
                                if (isAutoResetMode)
                                {
                                    faceTracker.reset();
                                }
                            }
                        }
                }

                //track face points.if face points <= 0, always return false.
                if (faceTracker.track(grayMat, faceTrackerParams))
                {
                    faceTracker.draw(rgbaMat, new Scalar(255, 0, 0, 255), new Scalar(0, 255, 0, 255));
                }

                                #if OPENCV_2
                Core.putText(rgbaMat, "'Tap' or 'Space Key' to Reset", new Point(5, rgbaMat.rows() - 5), Core.FONT_HERSHEY_SIMPLEX, 0.8, new Scalar(255, 255, 255, 255), 2, Core.LINE_AA, false);
                                #else
                Imgproc.putText(rgbaMat, "'Tap' or 'Space Key' to Reset", new Point(5, rgbaMat.rows() - 5), Core.FONT_HERSHEY_SIMPLEX, 0.8, new Scalar(255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
                                #endif

                //              Core.putText (rgbaMat, "W:" + rgbaMat.width () + " H:" + rgbaMat.height () + " SO:" + Screen.orientation, new Point (5, rgbaMat.rows () - 10), Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar (255, 255, 255, 255), 2, Core.LINE_AA, false);

                Utils.matToTexture2D(rgbaMat, texture, webCamTextureToMatHelper.GetBufferColors());
            }

            if (Input.GetKeyUp(KeyCode.Space) || Input.touchCount > 0)
            {
                faceTracker.reset();
            }
        }