X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_physics.h;h=20ce7f5d2877aca286dd45a70d0ea0fe6a836356;hb=d8fc0acce1b39466038284aa6f1941ebe98c8348;hp=52e4c3080f82aa4dcae6a9e5e4d6a182942d2c86;hpb=ec0918b2ef17a71418a57417689fd3042915aeeb;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_physics.h b/player_physics.h index 52e4c30..20ce7f5 100644 --- a/player_physics.h +++ b/player_physics.h @@ -161,7 +161,7 @@ VG_STATIC void player_physics_control(void) } static int push_thresh_last = 0; - float push = player.input_push->axis.value; + float push = player.input_push->button.value; int push_thresh = push>0.15f? 1: 0; if( push_thresh && !push_thresh_last ) @@ -401,10 +401,14 @@ VG_STATIC void player_walk_physics(void) player.input_walkv->axis.value }; if( v2_length2(walk) > 0.001f ) - v2_normalize( walk ); + v2_normalize_clamp( walk ); - v2_muls( walk, vg_maxf( player.input_push->axis.value, 0.5f ) * - k_walkspeed * VG_TIMESTEP_FIXED, walk ); + player.walk = v2_length( walk ); + + if( player.input_walk->button.value ) + v2_muls( walk, 0.5f, walk ); + + v2_muls( walk, k_walkspeed * VG_TIMESTEP_FIXED, walk ); v3f walk_apply; v3_zero( walk_apply ); @@ -829,6 +833,9 @@ VG_STATIC void player_freecam(void) m3x3_mulv( camera_mtx, sidedir, sidedir ); static v3f move_vel = { 0.0f, 0.0f, 0.0f }; + + /* TODO */ +#if 0 if( vg_get_button( "forward" ) ) v3_muladds( move_vel, lookdir, VG_TIMESTEP_FIXED * movespeed, move_vel ); if( vg_get_button( "back" ) ) @@ -837,6 +844,7 @@ VG_STATIC void player_freecam(void) v3_muladds( move_vel, sidedir, VG_TIMESTEP_FIXED *-movespeed, move_vel ); if( vg_get_button( "right" ) ) v3_muladds( move_vel, sidedir, VG_TIMESTEP_FIXED * movespeed, move_vel ); +#endif v3_muls( move_vel, 0.7f, move_vel ); v3_add( move_vel, player.camera_pos, player.camera_pos );