File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -197,13 +197,17 @@ void Camera::step(f32 dtime)
197
197
198
198
void Camera::addArmInertia (f32 player_yaw, f32 frametime)
199
199
{
200
- if (m_timer.X == 0 .0f )
201
- m_cam_vel.X = std::fabs ((m_last_cam_pos.X - player_yaw)) * 0 .01f ;
200
+ if (m_timer.X == 0 .0f ) {
201
+ // In the limit case where timer is 0 set a static velocity (generic case divide by zero)
202
+ m_cam_vel.X = 1 .0001f ;
203
+ }
202
204
else
203
205
m_cam_vel.X = std::fabs ((m_last_cam_pos.X - player_yaw) / m_timer.X ) * 0 .01f ;
204
206
205
- if (m_timer.Y == 0 .0f )
206
- m_cam_vel.Y = std::fabs (m_last_cam_pos.Y - m_camera_direction.Y );
207
+ if (m_timer.Y == 0 .0f ) {
208
+ // In the limit case where timer is 0 set a static velocity (generic case divide by zero)
209
+ m_cam_vel.Y = 1 .0001f ;
210
+ }
207
211
else
208
212
m_cam_vel.Y = std::fabs ((m_last_cam_pos.Y - m_camera_direction.Y ) / m_timer.Y );
209
213
You can’t perform that action at this time.
0 commit comments