From aa8df112ff42d94b6dc59a0153d989bd8c0b115e Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 27 Nov 2019 20:36:51 +0100 Subject: 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 --- src/client/camera.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/client/camera.cpp') 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) { -- cgit v1.2.3