Skip to content

Commit c4f1a70

Browse files
SmallJokerparamat
authored andcommittedNov 8, 2018
New sneak: Smoothen the climb up event (#7727)
1 parent 3a992ce commit c4f1a70

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

Diff for: ‎src/localplayer.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,14 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
376376
m_speed.Z = 0;
377377
}
378378

379-
if (y_diff > 0 && m_speed.Y < 0 &&
379+
if (y_diff > 0 && m_speed.Y <= 0 &&
380380
(physics_override_sneak_glitch || y_diff < BS * 0.6f)) {
381381
// Move player to the maximal height when falling or when
382382
// the ledge is climbed on the next step.
383-
position.Y = bmax.Y;
383+
384+
// Smoothen the movement (based on 'position.Y = bmax.Y')
385+
position.Y += y_diff * dtime * 22.0f + BS * 0.01f;
386+
position.Y = std::min(position.Y, bmax.Y);
384387
m_speed.Y = 0;
385388
}
386389

0 commit comments

Comments
 (0)
Please sign in to comment.