Add path height correction on world load

This commit is contained in:
David Markowitz
2023-08-06 15:41:38 -07:00
parent cefdfc696a
commit 8117773c56
4 changed files with 22 additions and 7 deletions

View File

@@ -3,4 +3,5 @@ set(DZONEMANAGER_SOURCES "dZoneManager.cpp"
"Spawner.cpp"
"Zone.cpp")
add_library(dZoneManager STATIC ${DZONEMANAGER_SOURCES})
add_library(dZoneManager STATIC ${DZONEMANAGER_SOURCES})
target_link_libraries(dZoneManager dPhysics)

View File

@@ -13,6 +13,7 @@
#include "CDZoneTableTable.h"
#include "Spawner.h"
#include "dZoneManager.h"
#include "dpWorld.h"
#include "eTriggerCommandType.h"
#include "eTriggerEventType.h"
@@ -544,10 +545,15 @@ void Zone::LoadPath(std::istream& file) {
}
}
// We verify the waypoint heights against the navmesh because in many movement paths,
// the waypoint is located near 0 height,
if (path.pathType == PathType::Movement) {
if (dpWorld::Instance().IsLoaded()) {
// 1000 should be large enough for every world.
waypoint.position.y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(waypoint.position, 1000.0f);
}
}
path.pathWaypoints.push_back(waypoint);
}
m_Paths.push_back(path);
}