Skip to content
Permalink
Browse files

Fix camera "jumping" when attached and the parent goes too fast

  • Loading branch information
Zeg9 authored and PilzAdam committed Apr 3, 2013
1 parent f85c116 commit c1bf6f9f7a6d2c5bd743422593a5ec72939bc6af
Showing with 8 additions and 0 deletions.
  1. +2 −0 src/camera.cpp
  2. +1 −0 src/content_cao.cpp
  3. +1 −0 src/localplayer.cpp
  4. +4 −0 src/localplayer.h
@@ -218,6 +218,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
// 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)
if(player->touching_ground &&
player_position.Y > old_player_position.Y)
@@ -1129,6 +1129,7 @@ class GenericCAO : public ClientActiveObject
{
LocalPlayer *player = m_env->getLocalPlayer();
player->overridePosition = getParent()->getPosition();
m_env->getLocalPlayer()->parent = getParent();
}
}
else
@@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

LocalPlayer::LocalPlayer(IGameDef *gamedef):
Player(gamedef),
parent(0),
isAttached(false),
overridePosition(v3f(0,0,0)),
last_position(v3f(0,0,0)),
@@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

class ClientEnvironment;

class ClientActiveObject;

class LocalPlayer : public Player
{
public:
@@ -35,6 +37,8 @@ class LocalPlayer : public Player
{
return true;
}

ClientActiveObject *parent;

bool isAttached;

0 comments on commit c1bf6f9

Please sign in to comment.
You can’t perform that action at this time.