美文网首页
获取鼠标点击的位置

获取鼠标点击的位置

作者: Kyle_An | 来源:发表于2017-11-19 15:36 被阅读0次
void Update () {
        if (Input.GetMouseButtonDown(1))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray,out hit))
            {
                Debug.Log("鼠标右击点击位置" + hit.point);
            }
        }
    }

相关文章

网友评论

      本文标题:获取鼠标点击的位置

      本文链接:https://www.haomeiwen.com/subject/gfxpvxtx.html