aboutsummaryrefslogtreecommitdiff
path: root/src/client/localplayer.cpp
diff options
context:
space:
mode:
authorGregor Parzefall <82708541+grorp@users.noreply.github.com>2022-03-14 21:01:18 +0100
committersfan5 <sfan5@live.de>2022-05-14 18:33:42 +0200
commitb4f0e834bf7f0b40eae3924d2e1ac8bfed023659 (patch)
tree4be8ee0ecca7b507490dc18c48a956bca781a11e /src/client/localplayer.cpp
parent6e6cdc834fc2bf6192092d7a29aea72b760fa930 (diff)
downloadminetest-b4f0e834bf7f0b40eae3924d2e1ac8bfed023659.tar.gz
minetest-b4f0e834bf7f0b40eae3924d2e1ac8bfed023659.tar.bz2
minetest-b4f0e834bf7f0b40eae3924d2e1ac8bfed023659.zip
Fix footsteps for players whose collision box min y != 0 (#12110)
Diffstat (limited to 'src/client/localplayer.cpp')
-rw-r--r--src/client/localplayer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp
index 4f1ea7bda..279efafe9 100644
--- a/src/client/localplayer.cpp
+++ b/src/client/localplayer.cpp
@@ -672,19 +672,21 @@ v3s16 LocalPlayer::getStandingNodePos()
v3s16 LocalPlayer::getFootstepNodePos()
{
+ v3f feet_pos = getPosition() + v3f(0.0f, m_collisionbox.MinEdge.Y, 0.0f);
+
// Emit swimming sound if the player is in liquid
if (in_liquid_stable)
- return floatToInt(getPosition(), BS);
+ return floatToInt(feet_pos, BS);
// BS * 0.05 below the player's feet ensures a 1/16th height
// nodebox is detected instead of the node below it.
if (touching_ground)
- return floatToInt(getPosition() - v3f(0.0f, BS * 0.05f, 0.0f), BS);
+ return floatToInt(feet_pos - v3f(0.0f, BS * 0.05f, 0.0f), BS);
// A larger distance below is necessary for a footstep sound
// when landing after a jump or fall. BS * 0.5 ensures water
// sounds when swimming in 1 node deep water.
- return floatToInt(getPosition() - v3f(0.0f, BS * 0.5f, 0.0f), BS);
+ return floatToInt(feet_pos - v3f(0.0f, BS * 0.5f, 0.0f), BS);
}
v3s16 LocalPlayer::getLightPosition() const