float c = waypoint_getdistancecost_simple(vlen(to - from));
float height = from.z - to.z;
- if(height > 0 && autocvar_sv_gravity > 0)
+ if(height > jumpheight_vec.z && autocvar_sv_gravity > 0)
{
float height_cost = sqrt(height / (autocvar_sv_gravity / 2));
- float xydist = vlen(vec2(to - from));
- float xydist_cost = xydist / autocvar_sv_maxspeed;
- if(max(height_cost, xydist_cost) < c)
- c = max(height_cost, xydist_cost);
+ c = waypoint_getdistancecost_simple(vlen(vec2(to - from))); // xy distance cost
+ if(height_cost > c)
+ c = height_cost;
}
return c;
}