Skip to content

Commit

Permalink
fix snapvector > framerate dependent movement physics
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxor4d committed Sep 16, 2022
1 parent 7ca14d0 commit 7f7d197
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/common/physx/cct_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,14 +1315,18 @@ void snap_vector(PxVec3& v)
//v.y = static_cast<float>( static_cast<int>(v.y + 0.5f) );
//v.z = static_cast<float>( static_cast<int>(v.z + 0.5f) );

v.x = static_cast<float>(static_cast<int>(v.x));
/*v.x = static_cast<float>(static_cast<int>(v.x));
v.y = static_cast<float>(static_cast<int>(v.y));
v.z = static_cast<float>(static_cast<int>(v.z));
v.z = static_cast<float>(static_cast<int>(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)
Expand Down Expand Up @@ -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);
}

0 comments on commit 7f7d197

Please sign in to comment.