aboutsummaryrefslogtreecommitdiff
path: root/src/client/camera.cpp
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2019-11-27 20:36:51 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2019-12-07 15:12:26 +0100
commitaa8df112ff42d94b6dc59a0153d989bd8c0b115e (patch)
tree3488aea2ccd10228740d810f9a34da2260c95a57 /src/client/camera.cpp
parent51f230895c2b6d99a6fddc1c235140fcf9938742 (diff)
downloadminetest-aa8df112ff42d94b6dc59a0153d989bd8c0b115e.tar.gz
minetest-aa8df112ff42d94b6dc59a0153d989bd8c0b115e.tar.bz2
minetest-aa8df112ff42d94b6dc59a0153d989bd8c0b115e.zip
Attachments: Fix interpolation from (0,0,0) after detach
GenericCAO::getPosition() did not take the camera offset into account LocalPlayer attachment cleanup: Use sane getParent() function Make that getPosition() (GenericCAO and LocalPlayer) always return the absolute position
Diffstat (limited to 'src/client/camera.cpp')
-rw-r--r--src/client/camera.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/camera.cpp b/src/client/camera.cpp
index d1e76026d..464644044 100644
--- a/src/client/camera.cpp
+++ b/src/client/camera.cpp
@@ -285,9 +285,13 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
// Smooth the movement when walking up stairs
v3f old_player_position = m_playernode->getPosition();
v3f player_position = player->getPosition();
- if (player->isAttached && player->parent)
- player_position = player->parent->getPosition();
- //if(player->touching_ground && player_position.Y > old_player_position.Y)
+
+ // This is worse than `LocalPlayer::getPosition()` but
+ // mods expect the player head to be at the parent's position
+ // plus eye height.
+ if (player->getParent())
+ player_position = player->getParent()->getPosition();
+
if(player->touching_ground &&
player_position.Y > old_player_position.Y)
{