X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_skate.c;h=a89783c7e15ef669355b154114b2ea6aa7a0ebcd;hb=77c64b6f11663f59bc5753e4bade5bc165d36ca6;hp=41e03a40b46e836e30d2543279f9753c624a86b6;hpb=df9f72d2912a5424d37dfdb02f76aba8f1ed4df1;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_skate.c b/player_skate.c index 41e03a4..a89783c 100644 --- a/player_skate.c +++ b/player_skate.c @@ -181,8 +181,7 @@ too_many_samples: if( sample_count < 2 ) return 0; - v3f - average_direction, + v3f average_direction, average_normal; v2f min_co, max_co; @@ -227,6 +226,10 @@ too_many_samples: v3_copy( si->normal3, n0 ); v3_copy( sj->normal3, n1 ); v3_cross( n0, n1, dir ); + + if( v3_length2( dir ) <= 0.001f ) + continue; + v3_normalize( dir ); /* make sure the directions all face a common hemisphere */ @@ -1102,7 +1105,13 @@ static void player__skate_pre_update(void){ v3_copy( localplayer.cam.angles, localplayer.angles ); localplayer.angles[2] = 0.0f; - player__begin_holdout(); + v3f newpos, offset; + m4x3_mulv( localplayer.rb.to_world, (v3f){0.0f,1.0f,0.0f}, newpos ); + v3_add( newpos, (v3f){0.0f,-1.0f,0.0f}, newpos ); + v3_sub( localplayer.rb.co, newpos, offset ); + v3_copy( newpos, localplayer.rb.co ); + + player__begin_holdout( offset ); player__skate_kill_audio(); player__walk_transition(); return; @@ -2676,7 +2685,9 @@ static void player__skate_animate(void){ (1.0f-fabsf(animator->slide)*0.9f); animator->offset[1]=vg_clampf(animator->offset[1],-0.5f,0.0f); - v3_muls( animator->offset, 0.3f, localplayer.cam_control.tpv_offset_extra ); + v3f cam_offset; + v3_mul( animator->offset, (v3f){1.0f,0.3f,1.0f}, cam_offset ); + v3_copy( cam_offset, localplayer.cam_control.tpv_offset_extra ); /* localized vectors */ m4x3_mulv( localplayer.rb.to_local, state->cog, animator->local_cog );