mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 09:28:06 +00:00
woirking
This commit is contained in:
@@ -30,7 +30,7 @@ dNavMesh::dNavMesh(uint32_t zoneId) {
|
||||
dNavMesh::~dNavMesh() {
|
||||
// Clean up Recast information
|
||||
|
||||
if(m_Solid) rcFreeHeightField(m_Solid);
|
||||
if (m_Solid) rcFreeHeightField(m_Solid);
|
||||
if (m_CHF) rcFreeCompactHeightfield(m_CHF);
|
||||
if (m_CSet) rcFreeContourSet(m_CSet);
|
||||
if (m_PMesh) rcFreePolyMesh(m_PMesh);
|
||||
@@ -135,17 +135,19 @@ float dNavMesh::GetHeightAtPoint(const NiPoint3& location, const float halfExten
|
||||
float nearestPoint[3] = { 0.0f, 0.0f, 0.0f };
|
||||
dtQueryFilter filter{};
|
||||
|
||||
auto res = m_NavQuery->findNearestPoly(pos, polyPickExt, &filter, &nearestRef, nearestPoint);
|
||||
res = m_NavQuery->getPolyHeight(nearestRef, pos, &toReturn);
|
||||
auto hasPoly = m_NavQuery->findNearestPoly(pos, polyPickExt, &filter, &nearestRef, nearestPoint);
|
||||
m_NavQuery->getPolyHeight(nearestRef, pos, &toReturn);
|
||||
if (toReturn != 0.0f) {
|
||||
DluAssert(toReturn == nearestPoint[1]);
|
||||
}
|
||||
if (toReturn == 0.0f) {
|
||||
toReturn = location.y;
|
||||
// If we were unable to get the poly height, but the query returned a success, just use the height of the nearest point.
|
||||
// This is what seems to happen anyways and it is better than returning zero.
|
||||
} else if (res == DT_SUCCESS) {
|
||||
toReturn = nearestPoint[1];
|
||||
// If we were unable to get the poly height, but the query returned a success, just use the height of the nearest point.
|
||||
// This is what seems to happen anyways and it is better than returning zero.
|
||||
if (hasPoly == DT_SUCCESS) {
|
||||
toReturn = nearestPoint[1];
|
||||
} else {
|
||||
toReturn = location.y;
|
||||
}
|
||||
}
|
||||
// If we failed to even find a poly, do not change the height since we have no idea what it should be.
|
||||
|
||||
|
Reference in New Issue
Block a user