nav: add option to configure slope height for autogenerated graphs (ref #580)

This commit is contained in:
jeefo 2024-05-30 11:16:13 +03:00
commit bd9286cf87
No known key found for this signature in database
GPG key ID: D696786B81B667C8

View file

@ -8,6 +8,7 @@
#include <yapb.h> #include <yapb.h>
ConVar cv_has_team_semiclip ("has_team_semiclip", "0", "When enabled, bots will not try to avoid teammates on their way. Assuming some of the semiclip plugins are in use."); ConVar cv_has_team_semiclip ("has_team_semiclip", "0", "When enabled, bots will not try to avoid teammates on their way. Assuming some of the semiclip plugins are in use.");
ConVar cv_graph_slope_height ("graph_slope_height", "24.0", "Determines the maximum slope height change between the current and next node to consider the current link as a jump link. Only for generated graphs.", true, 12.0f, 48.0f);
int Bot::findBestGoal () { int Bot::findBestGoal () {
if (m_isCreature) { if (m_isCreature) {
@ -2458,7 +2459,7 @@ bool Bot::advanceMovement () {
const float diff = cr::abs (m_path->origin.z - graph[destIndex].origin.z); const float diff = cr::abs (m_path->origin.z - graph[destIndex].origin.z);
// if height difference is enough, consider this link as jump link // if height difference is enough, consider this link as jump link
if (graph[destIndex].origin.z > m_path->origin.z && diff > 18.0f) { if (graph[destIndex].origin.z > m_path->origin.z && diff > cv_graph_slope_height.as <float> ()) {
m_currentTravelFlags |= PathFlag::Jump; m_currentTravelFlags |= PathFlag::Jump;
m_desiredVelocity = nullptr; // make bot compute jump velocity m_desiredVelocity = nullptr; // make bot compute jump velocity
m_jumpFinished = false; // force-mark this path as jump m_jumpFinished = false; // force-mark this path as jump