From 3034f7accd3eff4107dd46abf91319cc1e8d96d6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 31 Dec 2021 00:12:27 +0100 Subject: [PATCH] Use in-out easing for better animation interpolation The difference is mainly noticeable on high refresh-rate monitors, but it affects both third-person animations and first-person weapons. The effect on first-person weapons is mainly visible after switching to certain weapons such as the pistol, shotgun and zapper. The animation interpolation duration has been slightly lengthened to better make use of the new easing. --- src/engine/animmodel.h | 4 +++- src/engine/rendermodel.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine/animmodel.h b/src/engine/animmodel.h index 357baa487..53f4ac8c9 100644 --- a/src/engine/animmodel.h +++ b/src/engine/animmodel.h @@ -1123,7 +1123,9 @@ struct animmodel : model if(diffaniminterp[interp].prev); - p.interp = diff/float(aitime); + // use easeInOutSine easing for smoother appearance + // https://easings.net/#easeInOutSine + p.interp = -(cos(M_PI * diff/float(aitime)) - 1) / 2; } } } diff --git a/src/engine/rendermodel.cpp b/src/engine/rendermodel.cpp index ef090b2cc..ad7f80499 100644 --- a/src/engine/rendermodel.cpp +++ b/src/engine/rendermodel.cpp @@ -1,7 +1,7 @@ #include "engine.h" VAR(0, oqdynent, 0, 1, 1); -VAR(0, animationinterpolationtime, 0, 200, 1000); +VAR(0, animationinterpolationtime, 0, 220, 1000); model *loadingmodel = NULL;