File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -197,17 +197,23 @@ void Camera::step(f32 dtime)
197
197
198
198
void Camera::addArmInertia (f32 player_yaw, f32 frametime)
199
199
{
200
- m_cam_vel.X = std::fabs ((m_last_cam_pos.X - player_yaw) / m_timer.X ) * 0 .01f ;
201
- m_cam_vel.Y = std::fabs ((m_last_cam_pos.Y - m_camera_direction.Y ) / m_timer.Y );
200
+ if (m_timer.X == 0 .0f )
201
+ m_cam_vel.X = std::fabs ((m_last_cam_pos.X - player_yaw)) * 0 .01f ;
202
+ else
203
+ m_cam_vel.X = std::fabs ((m_last_cam_pos.X - player_yaw) / m_timer.X ) * 0 .01f ;
204
+
205
+ if (m_timer.Y == 0 .0f )
206
+ m_cam_vel.Y = std::fabs (m_last_cam_pos.Y - m_camera_direction.Y );
207
+ else
208
+ m_cam_vel.Y = std::fabs ((m_last_cam_pos.Y - m_camera_direction.Y ) / m_timer.Y );
202
209
203
210
if (m_cam_vel.X > 1 .0f || m_cam_vel.Y > 1 .0f ) {
204
211
/*
205
212
the arm moves when the camera moves fast enough.
206
213
*/
207
214
208
215
if (m_cam_vel.X > 1 .0f ) {
209
- m_timer.X = 0 .0f ;
210
- m_timer.X += frametime;
216
+ m_timer.X = frametime;
211
217
212
218
if (m_cam_vel.X > m_cam_vel_old.X )
213
219
m_cam_vel_old.X = m_cam_vel.X ;
@@ -226,8 +232,7 @@ void Camera::addArmInertia(f32 player_yaw, f32 frametime)
226
232
}
227
233
228
234
if (m_cam_vel.Y > 1 .0f ) {
229
- m_timer.Y = 0 .0f ;
230
- m_timer.Y += frametime;
235
+ m_timer.Y = frametime;
231
236
232
237
if (m_cam_vel.Y > m_cam_vel_old.Y )
233
238
m_cam_vel_old.Y = m_cam_vel.Y ;
You can’t perform that action at this time.
1 commit comments
kilbith commentedon Jun 27, 2017
Achtung! This commit caused a regression: #6060