mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Use closestPointOnPoly instead of getPolyHeight in dtNavMeshQuery::findRandomPoint
This commit is contained in:
parent
56dd3802f8
commit
8709a256d9
@ -301,11 +301,7 @@ dtStatus dtNavMeshQuery::findRandomPoint(const dtQueryFilter* filter, float (*fr
|
|||||||
float pt[3];
|
float pt[3];
|
||||||
dtRandomPointInConvexPoly(verts, poly->vertCount, areas, s, t, pt);
|
dtRandomPointInConvexPoly(verts, poly->vertCount, areas, s, t, pt);
|
||||||
|
|
||||||
float h = 0.0f;
|
closestPointOnPoly(polyRef, pt, pt, NULL);
|
||||||
dtStatus status = getPolyHeight(polyRef, pt, &h);
|
|
||||||
if (dtStatusFailed(status))
|
|
||||||
return status;
|
|
||||||
pt[2] = h;
|
|
||||||
|
|
||||||
dtVcopy(randomPt, pt);
|
dtVcopy(randomPt, pt);
|
||||||
*randomRef = polyRef;
|
*randomRef = polyRef;
|
||||||
@ -487,17 +483,13 @@ dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const f
|
|||||||
|
|
||||||
float pt[3];
|
float pt[3];
|
||||||
dtRandomPointInConvexPoly(verts, randomPoly->vertCount, areas, s, t, pt);
|
dtRandomPointInConvexPoly(verts, randomPoly->vertCount, areas, s, t, pt);
|
||||||
|
|
||||||
float h = 0.0f;
|
closestPointOnPoly(randomPolyRef, pt, pt, NULL);
|
||||||
dtStatus stat = getPolyHeight(randomPolyRef, pt, &h);
|
|
||||||
if (dtStatusFailed(status))
|
|
||||||
return stat;
|
|
||||||
pt[2] = h;
|
|
||||||
|
|
||||||
dtVcopy(randomPt, pt);
|
dtVcopy(randomPt, pt);
|
||||||
*randomRef = randomPolyRef;
|
*randomRef = randomPolyRef;
|
||||||
|
|
||||||
return DT_SUCCESS;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user