1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

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
This commit is contained in:
SmallJoker 2019-11-27 20:36:51 +01:00 committed by SmallJoker
parent 51f230895c
commit aa8df112ff
7 changed files with 57 additions and 61 deletions

View file

@ -47,12 +47,9 @@ public:
LocalPlayer(Client *client, const char *name);
virtual ~LocalPlayer() = default;
ClientActiveObject *parent = nullptr;
// Initialize hp to 0, so that no hearts will be shown if server
// doesn't support health points
u16 hp = 0;
bool isAttached = false;
bool touching_ground = false;
// This oscillates so that the player jumps a bit above the surface
bool in_liquid = false;
@ -72,8 +69,6 @@ public:
// Temporary option for old move code
bool physics_override_new_move = true;
v3f overridePosition;
void move(f32 dtime, Environment *env, f32 pos_max_d);
void move(f32 dtime, Environment *env, f32 pos_max_d,
std::vector<CollisionInfo> *collision_info);
@ -112,6 +107,8 @@ public:
GenericCAO *getCAO() const { return m_cao; }
ClientActiveObject *getParent() const;
void setCAO(GenericCAO *toset)
{
assert(!m_cao); // Pre-condition