Recast: fix poly detail height bug when height isn't found

The height couldn't be found on some edge case scenarios (typically complex geometry), but in these cases the height was still set to (unsigned short)-1, causing it to return a height very far into positive Z. The vert would therefore appears very far into the sky. This patch fixes this problem.
This commit is contained in:
Kawe Mazidjatari 2024-07-12 14:13:08 +02:00
parent f95eb13ab3
commit 88052ba558

View File

@ -278,6 +278,11 @@ static unsigned short getHeight(const float fx, const float fy, const float fz,
y += dy;
}
}
// No height found, return a reasonable fall back height.
if (h == RC_UNSET_HEIGHT)
h = (unsigned short)floorf(fz/ch);
return h;
}