Hello unity3d!

Unity3D鼠标坐标转世界坐标和局部坐标

鼠标坐标转世界坐标和局部坐标:
    Vector3 MousePosition2Local () {
        mousePosition = Input.mousePosition; //获取屏幕坐标
        mouseWorldPos = Camera.main.ScreenToWorldPoint (mousePosition); //屏幕坐标转世界坐标
        mouseLocalPos = transform.parent.transform.InverseTransformPoint (mouseWorldPos); //世界坐标转本地坐标

        return CorrectPos(mouseLocalPos);
    }

 

posted @ 2017-01-13 11:18  子非鱼`  阅读(9062)  评论(0编辑  收藏  举报
;