Merge pull request #119 from richard-fine/features/raycast-edgeinfo

Include hit edge index in dtRaycastHit.
This commit is contained in:
Mikko Mononen 2015-11-15 23:55:18 +02:00
commit 2ea77f6cf4
2 changed files with 6 additions and 0 deletions

View File

@ -132,6 +132,9 @@ struct dtRaycastHit
/// hitNormal The normal of the nearest wall hit. [(x, y, z)]
float hitNormal[3];
/// The index of the edge on the final polygon where the wall was hit.
int hitEdgeIndex;
/// Pointer to an array of reference ids of the visited polygons. [opt]
dtPolyRef* path;

View File

@ -2420,6 +2420,9 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons
hit->pathCount = n;
return status;
}
hit->hitEdgeIndex = segMax;
// Keep track of furthest t so far.
if (tmax > hit->t)
hit->t = tmax;