add motion vectors to all shaders
[carveJwlIkooP6JGAAIwe30JlM.git] / player_physics.h
index 86f49a0f34a824554f25d409e8cc23879cb824aa..f395953932e19003e93cac528d76c538cb99531e 100644 (file)
@@ -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;