X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_physics.h;h=56698f87e2ecdfd65fd44e083eed6b522d386c88;hb=6a9e3dd11c5546f7e403ff084949a2f35b13ac09;hp=db7105d1ed246bbfe95947a7612243dee5ca7541;hpb=1684abeac1624edd566f5b7c8c132cac65fcb3ed;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_physics.h b/player_physics.h index db7105d..56698f8 100644 --- a/player_physics.h +++ b/player_physics.h @@ -800,7 +800,11 @@ VG_STATIC int player_update_collision_manifold( rb_ct *manifold ) rb_manifold_filter_joint_edges( manifold, len_f, 0.05f ); rb_manifold_filter_pairs( manifold, len_f, 0.05f ); } - len_f = rb_manifold_apply_filtered( manifold, len_f ); + int new_len_f = rb_manifold_apply_filtered( manifold, len_f ); + if( len_f && !new_len_f ) + len_f = 1; + else + len_f = new_len_f; rb_ct *man_b = &manifold[len_f]; len_b = rb_sphere_scene( rbb, &world.rb_geo, man_b ); @@ -811,8 +815,11 @@ VG_STATIC int player_update_collision_manifold( rb_ct *manifold ) rb_manifold_filter_joint_edges( man_b, len_b, 0.05f ); rb_manifold_filter_pairs( man_b, len_b, 0.05f ); } - len_b = rb_manifold_apply_filtered( man_b, len_b ); - + int new_len_b = rb_manifold_apply_filtered( man_b, len_b ); + if( len_b && !new_len_b ) + len_b = 1; + else + len_b = new_len_b; #if 0 /* * Preprocess collision points, and create a surface picture. @@ -946,8 +953,8 @@ VG_STATIC void player_collision_response( rb_ct *manifold, int len ) * components. */ - float wy = v3_dot( phys->rb.up, impulse ), - wx = v3_dot( phys->rb.right, impulse )*1.8f; + float wy = v3_dot( phys->rb.up, impulse ) * 0.8f, + wx = v3_dot( phys->rb.right, impulse )*1.0f; v3_muladds( phys->rb.w, phys->rb.up, wy, phys->rb.w ); v3_muladds( phys->rb.w, phys->rb.right, wx, phys->rb.w ); @@ -1080,7 +1087,7 @@ VG_STATIC void player_do_motion(void) /* Real angular velocity integration */ - v3_lerp( phys->rb.w, (v3f){0.0f,0.0f,0.0f}, 0.125f, phys->rb.w ); + v3_lerp( phys->rb.w, (v3f){0.0f,0.0f,0.0f}, 0.125f*0.5f, phys->rb.w ); if( v3_length2( phys->rb.w ) > 0.0f ) { v4f rotation;