diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-11-08 22:12:39 +0100 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2018-11-08 21:12:39 +0000 |
commit | c4f1a709b1cd6d92df676817fc8cd13790ba4754 (patch) | |
tree | e303f628eafef665aa701ca50f32fdd50a8808cf /src/localplayer.cpp | |
parent | 3a992ce76d2c9261bcf35d9123d8c77a4c227eeb (diff) | |
download | minetest-c4f1a709b1cd6d92df676817fc8cd13790ba4754.tar.gz minetest-c4f1a709b1cd6d92df676817fc8cd13790ba4754.tar.bz2 minetest-c4f1a709b1cd6d92df676817fc8cd13790ba4754.zip |
New sneak: Smoothen the climb up event (#7727)
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 53d926882..4bf689428 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -376,11 +376,14 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d, m_speed.Z = 0; } - if (y_diff > 0 && m_speed.Y < 0 && + if (y_diff > 0 && m_speed.Y <= 0 && (physics_override_sneak_glitch || y_diff < BS * 0.6f)) { // Move player to the maximal height when falling or when // the ledge is climbed on the next step. - position.Y = bmax.Y; + + // Smoothen the movement (based on 'position.Y = bmax.Y') + position.Y += y_diff * dtime * 22.0f + BS * 0.01f; + position.Y = std::min(position.Y, bmax.Y); m_speed.Y = 0; } |