Recast: use spherical extends to clamp off-mesh link to poly

The traversability of off-mesh links is not dictated by the walkable climb in this engine; an off-mesh connection can be higher from the ground due to ziplines.
This commit is contained in:
Kawe Mazidjatari 2024-10-29 12:51:24 +01:00
parent 81c0cab610
commit 64de9f6a48

View File

@ -555,7 +555,7 @@ dtPolyRef dtNavMesh::clampOffMeshVertToPoly(dtOffMeshConnection* con, dtMeshTile
const dtMeshTile* lookupTile, const bool start)
{
const float* p = start ? &con->pos[0] : &con->pos[3];
const float halfExtents[3] = { con->rad, con->rad, lookupTile->header->walkableClimb };
const float halfExtents[3] = { con->rad, con->rad, con->rad };
float nearestPt[3];
dtPolyRef ref = findNearestPolyInTile(lookupTile, p, halfExtents, nearestPt);
@ -656,7 +656,7 @@ dtStatus dtNavMesh::connectOffMeshLinks(const dtTileRef tileRef)
return DT_FAILURE | DT_OUT_OF_MEMORY;
// connect to land points.
const float halfExtents[3] = { con->rad, con->rad, header->walkableClimb };
const float halfExtents[3] = { con->rad, con->rad, con->rad };
float bmin[3], bmax[3];
rdVsub(bmin, &con->pos[3], halfExtents);
rdVadd(bmax, &con->pos[3], halfExtents);