private float GetPointerBeamLength(bool hasRayHit, RaycastHit collidedWith)
    {
        float actualLength = pointerLength;

        //reset if beam not hitting or hitting new target
        if (!hasRayHit || (pointerContactTarget && pointerContactTarget != collidedWith.transform))
        {
            if (pointerContactTarget != null)
            {
                PointerOut();
            }


            if (pointerContactTarget && pointerContactTarget.GetComponent <SteamVR_InteractableObject>() != null)
            {
                pointerContactTarget.GetComponent <SteamVR_InteractableObject>().SelectTile(false);
            }

            if (pointerContactTarget && pointerContactTarget.GetComponent <TilePane> () != null)
            {
                if (m_TileInfo && m_TileInfo.activeSelf)
                {
                    m_TileInfo.SetActive(false);
                }
            }

            pointerContactDistance = 0f;
            pointerContactTarget   = null;
            destinationPosition    = Vector3.zero;

            UpdatePointerMaterial(pointerMissColor);
        }

        //check if beam has hit a new target
        if (hasRayHit)
        {
            if (collidedWith.transform.GetComponent <SteamVR_InteractableObject>() != null)
            {
                collidedWith.transform.GetComponent <SteamVR_InteractableObject>().SelectTile(true);
            }

            if (collidedWith.transform.GetComponent <TilePane> () != null)
            {
                PointerIn();
                if (m_TileInfo && !m_TileInfo.activeSelf)
                {
                    m_TxtInfo.SetContent(collidedWith.transform.GetComponent <TilePane> ().m_Tile.ImageDesc);
                    m_TxtInfo.GetComponent <PopupText> ().SetOriginalPosition();

                    if (GameObject.FindObjectOfType <GamePlayPane> ())
                    {
                        m_TileInfo.SetActive(false);
                    }
                    else
                    {
                        m_TileInfo.SetActive(true);
                    }
                }
            }
            else
            {
                PointerOut();
            }

            pointerContactDistance = collidedWith.distance;
            pointerContactTarget   = collidedWith.transform;
            destinationPosition    = pointerTip.transform.position;
            pointerTipPosition     = destinationPosition;

            UpdatePointerMaterial(pointerHitColor);
        }

        //adjust beam length if something is blocking it
        if (hasRayHit && pointerContactDistance < pointerLength)
        {
            actualLength = pointerContactDistance;
        }

        return(actualLength);
    }