From 7f7d1975748b75e094030e176b20e8b930f09ca4 Mon Sep 17 00:00:00 2001 From: xoxor4d <45299104+xoxor4d@users.noreply.github.com> Date: Fri, 16 Sep 2022 21:58:41 +0200 Subject: [PATCH] fix snapvector > framerate dependent movement physics --- src/common/physx/cct_camera.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/common/physx/cct_camera.cpp b/src/common/physx/cct_camera.cpp index 0a67fae..dc42403 100644 --- a/src/common/physx/cct_camera.cpp +++ b/src/common/physx/cct_camera.cpp @@ -1315,14 +1315,18 @@ void snap_vector(PxVec3& v) //v.y = static_cast( static_cast(v.y + 0.5f) ); //v.z = static_cast( static_cast(v.z + 0.5f) ); - v.x = static_cast(static_cast(v.x)); + /*v.x = static_cast(static_cast(v.x)); v.y = static_cast(static_cast(v.y)); - v.z = static_cast(static_cast(v.z)); + v.z = static_cast(static_cast(v.z));*/ /*if (do_print) { game::printf_to_console("snapvec after: %.4f\n-------\n", v.z); - }*/ + }*/ + + v.x = rint(v.x); + v.y = rint(v.y); + v.z = rint(v.z); } void physx_cct_camera::update(PxReal dtime) @@ -1391,6 +1395,5 @@ void physx_cct_camera::update(PxReal dtime) physx->m_cct_controller->sync(); } - // feels odd - // snap_vector(m_player_velocity); + snap_vector(m_player_velocity); } \ No newline at end of file