dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, const float* endPos,
const dtQueryFilter* filter, const unsigned int options,
dtRaycastHit* hit, dtPolyRef prevRef):
做2D的检测,忽略y轴
1 先让curRef = startRef;
2 while (curRef)
{
从tile->verts上获取这个poly的vertex放到verts里面
3 在curRef上进行碰撞dtIntersectSegmentPoly2D(startPos, endPos, verts, nv, tmin, tmax, segMin, segMax)
hit->hitEdgeIndex = segMax;
if (tmax > hit->t)
hit->t = tmax;
tmax表示碰撞之后已经到了本射线的几分之几了
hit->t保持这一记录
把碰撞到的polygon存起来hit->path[n++] = curRef;
segMax == -1的时候说明射线的end在这个poly里面
那就不用往下碰撞了,直接hit->pathCount = n;
hit->pathCost记录已经碰撞的poly的所有cost
4 接下来碰撞nextpoly for循环