@@ -89,6 +89,7 @@ Animatable3DObjClass::Animatable3DObjClass(const char * htree_name) :
8989 ModeAnim.Motion =NULL ;
9090 ModeAnim.Frame =0 .0f ;
9191 ModeAnim.PrevFrame =0 .0f ;
92+ ModeAnim.LastSyncTime =WW3D::Get_Logic_Time_Milliseconds ();
9293 ModeAnim.frameRateMultiplier =1.0 ; // 020607 srj -- added
9394 ModeAnim.animDirection =1.0 ; // 020607 srj -- added
9495 ModeInterp.Motion0 =NULL ;
@@ -144,6 +145,7 @@ Animatable3DObjClass::Animatable3DObjClass(const Animatable3DObjClass & src) :
144145 ModeAnim.Motion =NULL ;
145146 ModeAnim.Frame =0 .0f ;
146147 ModeAnim.PrevFrame =0 .0f ;
148+ ModeAnim.LastSyncTime =WW3D::Get_Logic_Time_Milliseconds ();
147149 ModeAnim.frameRateMultiplier =1.0 ; // 020607 srj -- added
148150 ModeAnim.animDirection =1.0 ; // 020607 srj -- added
149151 ModeInterp.Motion0 =NULL ;
@@ -203,6 +205,7 @@ Animatable3DObjClass & Animatable3DObjClass::operator = (const Animatable3DObjCl
203205 ModeAnim.Motion = NULL ;
204206 ModeAnim.Frame = 0 .0f ;
205207 ModeAnim.PrevFrame = 0 .0f ;
208+ ModeAnim.LastSyncTime = WW3D::Get_Logic_Time_Milliseconds ();
206209 ModeAnim.frameRateMultiplier =1.0 ; // 020607 srj -- added
207210 ModeAnim.animDirection =1.0 ; // 020607 srj -- added
208211 ModeInterp.Motion0 = NULL ;
@@ -471,6 +474,7 @@ void Animatable3DObjClass::Set_Animation(HAnimClass * motion, float frame, int m
471474 ModeAnim.Motion = motion;
472475 ModeAnim.PrevFrame = ModeAnim.Frame ;
473476 ModeAnim.Frame = frame;
477+ ModeAnim.LastSyncTime = WW3D::Get_Logic_Time_Milliseconds ();
474478 ModeAnim.frameRateMultiplier =1.0 ; // 020607 srj -- added
475479 ModeAnim.animDirection =1.0 ; // 020607 srj -- added
476480
@@ -947,13 +951,14 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const
947951 {
948952 frame = ModeAnim.Frame ;
949953
950- //
951- // Compute the current frame based on elapsed time.
952- //
953954 if (ModeAnim.AnimMode != ANIM_MODE_MANUAL) {
955+ //
956+ // Compute the current frame based on elapsed time.
957+ // TheSuperHackers @info Is using elapsed time because frame computation is not guaranteed to be called every render frame!
958+ //
954959 // TheSuperHackers @tweak The animation render update is now decoupled from the logic step.
955- const float frametime = WW3D::Get_Logic_Frame_Time_Seconds () ;
956- const float delta = ModeAnim.Motion ->Get_Frame_Rate () * ModeAnim.frameRateMultiplier * ModeAnim.animDirection * frametime ;
960+ const float timeDiff = WW3D::Get_Logic_Time_Milliseconds () - ModeAnim. LastSyncTime ;
961+ const float delta = ModeAnim.Motion ->Get_Frame_Rate () * ModeAnim.frameRateMultiplier * ModeAnim.animDirection * timeDiff * 0 . 001f ;
957962 frame += delta;
958963
959964 //
@@ -1050,6 +1055,7 @@ void Animatable3DObjClass::Single_Anim_Progress (void)
10501055 //
10511056 ModeAnim.PrevFrame = ModeAnim.Frame ;
10521057 ModeAnim.Frame = Compute_Current_Frame (&ModeAnim.animDirection );
1058+ ModeAnim.LastSyncTime = WW3D::Get_Logic_Time_Milliseconds ();
10531059}
10541060
10551061
0 commit comments