private void OnWillRenderObject()
    {
        /*
         * if (visible) { childScript.RenderMirror(); }
         * else
         * {
         *  Vector3 rayDirection = this.transform.position - mainCamera.transform.position;
         *  RaycastHit hit;
         *
         *  if (Physics.Raycast(mainCamera.transform.position, rayDirection, out hit, layerMask))
         *  {
         *      if (hit.transform.gameObject.tag == this.tag)
         *      {
         *          childScript.RenderMirror();
         *      }
         *  }
         * }
         */

        Vector3    rayDirection = this.transform.position - mainCamera.transform.position;
        RaycastHit hit;
        Ray        ray = new Ray(mainCamera.transform.position, rayDirection);

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
        {
            if (hit.transform.gameObject.tag == this.tag)
            {
                childScript.RenderMirror();
            }
            else
            {
                RandomCheckIfVisible();
                if (visible)
                {
                    childScript.RenderMirror();
                }
            }
        }
    }
Exemple #2
0
 private void OnWillRenderObject()
 {
     childScript.RenderMirror();
 }