physics
authorhgn <hgodden00@gmail.com>
Thu, 20 Oct 2022 21:38:41 +0000 (22:38 +0100)
committerhgn <hgodden00@gmail.com>
Thu, 20 Oct 2022 21:38:41 +0000 (22:38 +0100)
player.h
player_physics.h
world_routes.h

index e4814d3400d1b2066e24f769638b352dafc62ae8..fc435dc849bfdc34e19433108157b9bd90ab50f9 100644 (file)
--- a/player.h
+++ b/player.h
@@ -396,12 +396,9 @@ static void player_update_post(void)
 
             float dist = vg_maxf( v3_dist( fr->pos, fr1->pos ), 0.001f ),
                   subl = vg_fractf( player.rewind_time ) + 0.001f,
-                  
-#if 0
-                  speed=sqrtf(player.rewind_time*player.rewind_time+11.0f)*3.0f,
-#else
-                  speed = (3.0f-(1.0f/(0.4f+0.4f*player.rewind_time)))*28.0f,
-#endif
+
+                  sramp= 3.0f-(1.0f/(0.4f+0.4f*player.rewind_time)),
+                  speed = sramp*28.0f + 0.5f*player.rewind_time,
                   mod  = speed * (budget / dist),
 
                   advl = vg_minf( mod, subl ),
index 4a2add1b906fdd76f069c337aebdee1629157e48..b93ac0394b32aa8211cc0f7490b2134fa5cbd5c7 100644 (file)
@@ -521,6 +521,7 @@ static void player_physics(void)
 
    if( !phys->in_air )
    {
+#if 0
       v3f axis;
       float angle = v3_dot( phys->rb.up, surface_avg );
       v3_cross( phys->rb.up, surface_avg, axis );
@@ -534,6 +535,34 @@ static void player_physics(void)
          q_axis_angle( correction, axis, acosf(angle)*18.0f*VG_TIMESTEP_FIXED );
          q_mul( correction, phys->rb.q, phys->rb.q );
       }
+#else
+      
+      /* 20/10/22: make this only go axisways instead, may effect velocities. */
+
+      v3f projected, axis;
+
+      float d = v3_dot( phys->rb.forward, surface_avg );
+      v3_muladds( surface_avg, phys->rb.forward, -d, projected );
+      v3_normalize( projected );
+
+      float angle = v3_dot( phys->rb.up, projected );
+      v3_cross( phys->rb.up, projected, axis );
+
+      v3f p0, p1;
+      v3_add( phys->rb.co, projected, p0 );
+      v3_add( phys->rb.co, phys->rb.up, p1 );
+      vg_line( phys->rb.co, p0, 0xff00ff00 );
+      vg_line( phys->rb.co, p1, 0xff000fff );
+
+      if( fabsf(angle) < 0.999f )
+      {
+         v4f correction;
+         q_axis_angle( correction, axis, acosf(angle)*4.0f*VG_TIMESTEP_FIXED );
+         q_mul( correction, phys->rb.q, phys->rb.q );
+      }
+
+
+#endif
 
       float const DOWNFORCE = -k_downforce*VG_TIMESTEP_FIXED;
       v3_muladds( phys->rb.v, phys->rb.up, DOWNFORCE, phys->rb.v );
index 3de9278b5a13079cef0df65717b29058a00e9e93..07e35c71c4dd3d1f8792f0fa4e7f1b311e44126e 100644 (file)
@@ -431,7 +431,7 @@ static void world_routes_ui_draw( u32 route, v4f colour, float offset )
    fade_colour[3] *= 1.0f-fade_amt;
 
    /* 1 minute timer */
-   float timer_delta = (vg.time - world.routes.last_interaction) * (1.0/30.0),
+   float timer_delta = (vg.time - world.routes.last_interaction) * (1.0/45.0),
          timer_scale = 1.0f - vg_minf( timer_delta, 1.0f );
 
    /*