X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_physics.h;h=f395953932e19003e93cac528d76c538cb99531e;hb=c88172d6968a02a4e643b74cc419c0ac8168d92a;hp=86f49a0f34a824554f25d409e8cc23879cb824aa;hpb=75703291fbf045008a3b1ebb20fc46a2617b6b3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_physics.h b/player_physics.h index 86f49a0..f395953 100644 --- a/player_physics.h +++ b/player_physics.h @@ -980,11 +980,12 @@ VG_STATIC void player_do_motion(void) phys->grind = 1; v3f up = { 0.0f, 1.0f, 0.0f }; float angle = v3_dot( phys->rb.up, up ); - v3f axis; - v3_cross( phys->rb.up, up, axis ); if( fabsf(angle) < 0.99f ) { + v3f axis; + v3_cross( phys->rb.up, up, axis ); + v4f correction; q_axis_angle( correction, axis, VG_TIMESTEP_FIXED * 10.0f * acosf(angle) ); @@ -1130,8 +1131,8 @@ VG_STATIC void player_freecam(void) v3f lookdir = { 0.0f, 0.0f, -1.0f }, sidedir = { 1.0f, 0.0f, 0.0f }; - m3x3_mulv( camera_mtx, lookdir, lookdir ); - m3x3_mulv( camera_mtx, sidedir, sidedir ); + m3x3_mulv( main_camera.transform, lookdir, lookdir ); + m3x3_mulv( main_camera.transform, sidedir, sidedir ); static v3f move_vel = { 0.0f, 0.0f, 0.0f }; @@ -1193,6 +1194,13 @@ VG_STATIC int reset_player( int argc, char const *argv[] ) if( !rp ) { vg_error( "No spawn found\n" ); + vg_info( "Player position: %f %f %f\n", player.phys.rb.co[0], + player.phys.rb.co[1], + player.phys.rb.co[2] ); + vg_info( "Player velocity: %f %f %f\n", player.phys.rb.v[0], + player.phys.rb.v[1], + player.phys.rb.v[2] ); + if( !world.spawn_count ) return 0;