From 5ecddf16ae658b5f526d8d370a63223cf141a592 Mon Sep 17 00:00:00 2001 From: hgn Date: Sun, 1 Oct 2023 01:16:02 +0100 Subject: [PATCH 1/1] working? interpolation --- player_remote.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/player_remote.c b/player_remote.c index 4989b07..dc133b2 100644 --- a/player_remote.c +++ b/player_remote.c @@ -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 ); -- 2.25.1