void bot_calculate_stepheightvec(void)
{
stepheightvec = autocvar_sv_stepheight * '0 0 1';
+ jumpstepheightvec = stepheightvec +
+ ((autocvar_sv_jumpvelocity * autocvar_sv_jumpvelocity) / (2 * autocvar_sv_gravity)) * '0 0 0.9';
+ // 0.9 factor is for safety to make the jumps always work
}
void bot_serverframe()
float c1, c2, c3, c4;
void CheckAllowedTeams(entity for_whom); void GetTeamCounts(entity other);
float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
+
+void bot_calculate_stepheightvec(void);
if (trace_plane_normal_z < 0.7)
{
s = trace_fraction;
- tracebox(self.origin + '0 0 16', self.mins, self.maxs, self.origin + self.velocity * 0.2 + '0 0 16', FALSE, self);
+ tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, FALSE, self);
if (trace_fraction < s + 0.01)
if (trace_plane_normal_z < 0.7)
{
s = trace_fraction;
- tracebox(self.origin + '0 0 48', self.mins, self.maxs, self.origin + self.velocity * 0.2 + '0 0 48', FALSE, self);
+ tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, FALSE, self);
if (trace_fraction > s)
self.BUTTON_JUMP = 1;
}
// hit something
if (trace_fraction < 1)
{
- // check if we can walk over this obstacle
- tracebox(org + stepheightvec, m1, m2, move + stepheightvec, movemode, e);
+ // check if we can walk over this obstacle, possibly by jumpstepping
+ tracebox(org + jumpstepheightvec, m1, m2, move + jumpstepheightvec, movemode, e);
if (trace_fraction < 1 || trace_startsolid)
{
if(autocvar_bot_debug_tracewalk)
float bot_navigation_movemode;
float navigation_testtracewalk;
+vector jumpstepheightvec;
vector stepheightvec;
entity botframe_dangerwaypoint;