From: terencehill Date: Sat, 15 Jan 2011 16:35:38 +0000 (+0100) Subject: Measure acceleration in g (g force) X-Git-Tag: xonotic-v0.5.0~320 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=290121eadfb23419ab4b81d20c2c6009405a56ec;p=xonotic%2Fxonotic-data.pk3dir.git Measure acceleration in g (g force) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index bb4474062..99f35382e 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1428,7 +1428,7 @@ seta hud_panel_physics_speed_max 1800 "speed progressbar gets filled up complete seta hud_panel_physics_speed_vertical 0 "include the speed on the Z-axis" seta hud_panel_physics_topspeed 1 "also show top speed" seta hud_panel_physics_topspeed_time 4 "how many seconds the top speed takes to fade out" -seta hud_panel_physics_acceleration_max 2 "acceleration progressbar gets filled up completely by this value" +seta hud_panel_physics_acceleration_max 1.5 "acceleration progressbar gets completely filled up by this value (in g)" seta hud_panel_physics_acceleration_vertical 0 "include the acceleration on the Z-axis" seta hud_showbinds 1 "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index afdd8b4b7..b029ad450 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -4255,17 +4255,17 @@ void HUD_Physics(void) acceleration = autocvar_hud_panel_physics_acceleration_max * 0.3; else { + // 1 m/s = 0.0254 qu/s; 1 g = 9.80665 m/s^2 f = time - acc_prevtime; if(autocvar_hud_panel_physics_acceleration_vertical) - acceleration = (vlen(pmove_vel) - vlen(acc_prevspeed)) * (1 / f); + acceleration = (vlen(pmove_vel) - vlen(acc_prevspeed)) * (1 / f) * (0.0254 / 9.80665); else - acceleration = (vlen(pmove_vel - '0 0 1' * pmove_vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)) * (1 / f); + acceleration = (vlen(pmove_vel - '0 0 1' * pmove_vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)) * (1 / f) * (0.0254 / 9.80665); acc_prevspeed = pmove_vel; acc_prevtime = time; f = bound(0, f * 10, 1); acc_avg = acc_avg * (1 - f) + acceleration * f; - acceleration = acc_avg / getstatf(STAT_MOVEVARS_MAXSPEED); } //compute layout @@ -4311,7 +4311,6 @@ void HUD_Physics(void) HUD_Panel_GetProgressBarColor(speed); HUD_Panel_DrawProgressBar(panel_pos + speed_offset, panel_size, "progressbar", speed/max_speed, 0, speed_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - vector tmp_offset, tmp_size; tmp_size_x = panel_size_x * 0.75; tmp_size_y = panel_size_y; @@ -4404,7 +4403,7 @@ void HUD_Physics(void) HUD_Panel_GetProgressBarColor(acceleration); HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset, panel_size, "progressbar", acceleration/autocvar_hud_panel_physics_acceleration_max, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - drawstring_aspect(panel_pos + acceleration_offset, ftos_decimals(acceleration, 3), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(panel_pos + acceleration_offset, strcat(ftos_decimals(acceleration, 2), "g"), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } /*