求解这段实例代码的逻辑。。或者能看懂这段逻辑要先学习什么?

有人能帮我简单解释下这段代码都在干什么吗???咋算出来的目标坐标??屏幕坐标每个单位大小比如和世界坐标的每个单位大小不一样吗?比如50比1的比例???求解

void Sprite3DFakeShadowTest::onTouchesEnded(const std::vector<Touch*>& touches, cocos2d::Event *event)
{
for ( auto &item: touches )
{
auto touch = item;
auto location = touch->getLocationInView();
if(_camera)
{
if(_orc )
{
Vec3 nearP(location.x, location.y, -1.0f), farP(location.x, location.y, 1.0f);

            auto size = Director::getInstance()->getWinSize();
            nearP = _camera->unproject(nearP);
            farP = _camera->unproject(farP);
            Vec3 dir(farP - nearP);
            float dist=0.0f;
            float ndd = Vec3::dot(Vec3(0,1,0),dir);
            if(ndd == 0)
                dist=0.0f;
            float ndo = Vec3::dot(Vec3(0,1,0),nearP);
            dist= (0 - ndo) / ndd;
            Vec3 p =   nearP + dist *  dir;


            if( p.x > 100)
                p.x = 100;
            if( p.x < -100)
                p.x = -100;
            if( p.z > 100)
                p.z = 100;
            if( p.z < -100)
                p.z = -100;


            _targetPos=p;
        }
    }
}

}

:6: :6: :6: :6: 不麻烦的话简简单单提示几个字就好。。。比如unproject是屏幕坐标转换成世界坐标。。
但是我没明白的是为什么我无论点哪,nearP 总是在(0,,20,,25 )左右徘徊。。前后不差0.0几。。。。。基本固定这个数值。。。。。这个就是实例代码里面的Sprite3DFakeShadowTest例子。。。

相机位置如下:

_camera = Camera::createPerspective(60, visibleSize.width/visibleSize.height, 0.1f, 200);
_camera->setCameraFlag(CameraFlag::USER1);
_camera->setPosition3D(Vec3(0,20,25));
_camera->setRotation3D(Vec3(-60,0,0));

:3: :3: :3: :3: :3: :3: :3: :3: :3: