working? interpolation
authorhgn <hgodden00@gmail.com>
Sun, 1 Oct 2023 00:16:02 +0000 (01:16 +0100)
committerhgn <hgodden00@gmail.com>
Sun, 1 Oct 2023 00:16:02 +0000 (01:16 +0100)
player_remote.c

index 4989b078c803cf77bc185bec583cfb04c6e8204f..dc133b25f0454e34deabf12fc019d8671c73eae6 100644 (file)
@@ -285,6 +285,11 @@ static void pose_remote_player( u32 index,
                              posed.keyframes );
       }
 
+      v3_lerp( pose0.root_co, pose1.root_co, t, posed.root_co );
+      q_nlerp( pose0.root_q,  pose1.root_q,  t, posed.root_q );
+      posed.type = pose0.type;
+      posed.board.lean = vg_lerpf( pose0.board.lean, pose1.board.lean, t );
+
       apply_full_skeleton_pose( &av->sk, &posed, final_mtx );
    }
    else {
@@ -294,8 +299,8 @@ static void pose_remote_player( u32 index,
 
 static void animate_remote_player( u32 index ){
 
-   f64 min_time =  999999999.9,
-       max_time = -999999999.9,
+   f64 min_time = -999999999.9,
+       max_time =  999999999.9,
        abs_max_time = -999999999.9;
 
    struct interp_frame *minframe = NULL,
@@ -307,12 +312,12 @@ static void animate_remote_player( u32 index ){
       struct interp_frame *ifr = &buf->frames[i];
 
       if( ifr->active ){
-         if( (ifr->timestamp < min_time) && (ifr->timestamp > buf->t) ){
+         if( (ifr->timestamp > min_time) && (ifr->timestamp < buf->t) ){
             min_time = ifr->timestamp;
             minframe = ifr;
          }
 
-         if( (ifr->timestamp > max_time) && (ifr->timestamp < buf->t) ){
+         if( (ifr->timestamp < max_time) && (ifr->timestamp > buf->t) ){
             max_time = ifr->timestamp;
             maxframe = ifr;
          }
@@ -322,7 +327,7 @@ static void animate_remote_player( u32 index ){
             abs_max_frame = ifr;
          }
       }
-   }  
+   } 
    
    if( minframe && maxframe ){
       pose_remote_player( index, minframe, maxframe );