mirror of https://github.com/minetest/minetest.git
Fix camera "jumping" when attached and the parent goes too fast
This commit is contained in:
parent
896e1a30b0
commit
91c22d9528
|
@ -218,6 +218,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
|
||||||
// Smooth the movement when walking up stairs
|
// Smooth the movement when walking up stairs
|
||||||
v3f old_player_position = m_playernode->getPosition();
|
v3f old_player_position = m_playernode->getPosition();
|
||||||
v3f player_position = player->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)
|
||||||
if(player->touching_ground &&
|
if(player->touching_ground &&
|
||||||
player_position.Y > old_player_position.Y)
|
player_position.Y > old_player_position.Y)
|
||||||
|
|
|
@ -1111,6 +1111,7 @@ public:
|
||||||
{
|
{
|
||||||
LocalPlayer *player = m_env->getLocalPlayer();
|
LocalPlayer *player = m_env->getLocalPlayer();
|
||||||
player->overridePosition = getParent()->getPosition();
|
player->overridePosition = getParent()->getPosition();
|
||||||
|
m_env->getLocalPlayer()->parent = getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
LocalPlayer::LocalPlayer(IGameDef *gamedef):
|
LocalPlayer::LocalPlayer(IGameDef *gamedef):
|
||||||
Player(gamedef),
|
Player(gamedef),
|
||||||
|
parent(0),
|
||||||
isAttached(false),
|
isAttached(false),
|
||||||
overridePosition(v3f(0,0,0)),
|
overridePosition(v3f(0,0,0)),
|
||||||
last_position(v3f(0,0,0)),
|
last_position(v3f(0,0,0)),
|
||||||
|
|
|
@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
|
class ClientActiveObject;
|
||||||
|
|
||||||
class LocalPlayer : public Player
|
class LocalPlayer : public Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -32,6 +34,8 @@ public:
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientActiveObject *parent;
|
||||||
|
|
||||||
bool isAttached;
|
bool isAttached;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue