示例#1
0
    public static bool CheckWalkablePos(ref Vector3 pos)
    {
        //Ray r = Util.UICamera.ScreenPointToRay(InputUtil.GeTouchPos());
        //if (Physics.Raycast(r, 10000.0f, Util.UICamera.cullingMask))
        if (UICamera.lastHit.collider != null)
        {
            //Log.Info("hoveredObject: " + UICamera.lastHit.collider.name);
            return(false);
        }

        if (Application.isEditor == false)
        {
            if (Input.touchCount == 0)
            {
                return(false);
            }
        }

        RaycastHit hit;

        Ray r = Camera.main.ScreenPointToRay(InputUtil.GeTouchPos());

        if (Physics.Raycast(r, out hit, 50.0f, 1 << LayerUtil.walkable))
        {
            //Debug.Log("hit:" + hit.collider.gameObject.name);
            pos = hit.point;
            return(true);
        }

        return(false);
    }