Include hit edge index in dtRaycastHit.
This makes it simpler to investigate exactly what is blocking a ray - for example, if an agent cannot move onto a polygon due to QueryFilter flags, then this provides a way for the agent to find out which flags it needs to have and to perform a state change which alters its movement flags.
This commit is contained in:
parent
2bcd32b0a3
commit
67736ae7d5
@ -131,6 +131,9 @@ struct dtRaycastHit
|
|||||||
|
|
||||||
/// hitNormal The normal of the nearest wall hit. [(x, y, z)]
|
/// hitNormal The normal of the nearest wall hit. [(x, y, z)]
|
||||||
float hitNormal[3];
|
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]
|
/// Pointer to an array of reference ids of the visited polygons. [opt]
|
||||||
dtPolyRef* path;
|
dtPolyRef* path;
|
||||||
|
@ -2420,6 +2420,9 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons
|
|||||||
hit->pathCount = n;
|
hit->pathCount = n;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hit->hitEdgeIndex = segMax;
|
||||||
|
|
||||||
// Keep track of furthest t so far.
|
// Keep track of furthest t so far.
|
||||||
if (tmax > hit->t)
|
if (tmax > hit->t)
|
||||||
hit->t = tmax;
|
hit->t = tmax;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user