Camera: Fix wieldmesh glitch after teleporting (#6138)
authorkilbith <kilbith@users.noreply.github.com>
Sat, 15 Jul 2017 18:15:36 +0000 (20:15 +0200)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Sat, 15 Jul 2017 18:15:36 +0000 (20:15 +0200)
src/camera.cpp

index 35aaeaad4ef4059d586de477633d141f69527540..027e0ffc8608b7c29441038d9c21bc33d189b74f 100644 (file)
@@ -215,7 +215,8 @@ static inline v2f dir(const v2f &pos_dist)
 
 void Camera::addArmInertia(f32 player_yaw)
 {
-       m_cam_vel.X = std::fabs((m_last_cam_pos.X - player_yaw) / 0.016f) * 0.01f;
+       m_cam_vel.X = std::fabs(rangelim(m_last_cam_pos.X - player_yaw,
+               -100.0f, 100.0f) / 0.016f) * 0.01f;
        m_cam_vel.Y = std::fabs((m_last_cam_pos.Y - m_camera_direction.Y) / 0.016f);
        f32 gap_X = std::fabs(WIELDMESH_OFFSET_X - m_wieldmesh_offset.X);
        f32 gap_Y = std::fabs(WIELDMESH_OFFSET_Y - m_wieldmesh_offset.Y);