请问一下cameraTestDemo里面的targetPos 如何计算来的啊

                local nearP = cc.vec3(location.x, location.y, -1.0)
                local farP  = cc.vec3(location.x, location.y, 1.0)
                local size = cc.Director:getInstance():getWinSize()

                nearP = self._camera:unproject(size, nearP, nearP)
                farP  = self._camera:unproject(size, farP, farP)
                local dir = cc.vec3(farP.x - nearP.x, farP.y - nearP.y, farP.z - nearP.z)
                local dist=0.0
                local ndd = dir.x * 0 + dir.y * 1 + dir.z * 0
                if ndd == 0 then
                    dist=0.0
                end

                local ndo = nearP.x * 0 + nearP.y * 1 + nearP.z * 0
                dist= (0 - ndo) / ndd
                local p =   cc.vec3(nearP.x + dist * dir.x, nearP.y + dist * dir.y, nearP.z + dist * dir.z)
                self._targetPos = p

```



这是camera的朝向 
        self._camera:setPosition3D(cc.vec3(pos3D.x, pos3D.y + 130, pos3D.z + 130))
        self._camera:lookAt(self._sprite3D:getPosition3D(), cc.vec3(0, 1, 0))

我疑问是怎么得到这个targetPos 

                local ndd = dir.x * 0 + dir.y * 1 + dir.z * 0
                if ndd == 0 then
                    dist=0.0
                end

                local ndo = nearP.x * 0 + nearP.y * 1 + nearP.z * 0
                dist= (0 - ndo) / ndd
                local p =   cc.vec3(nearP.x + dist * dir.x, nearP.y + dist * dir.y, nearP.z + dist * dir.z)
这几句话是啥意思  有大侠帮忙解决下么

或者是我这样疑问 如何从屏幕的touch 转到一个layer 上来啊 这个layer 是绕x轴转一定的角度了 假设 然后这个camera 不是默认的设置了

就是从camera 的射线 怎么和这个layer 相交一点 能求出这个点在这个layer上的具体坐标么

只能依靠基本经验,以及数学功底:10::10::10: