collision_box.MaxEdge *= BS;
player->setCollisionbox(collision_box);
player->setCanZoom(m_prop.can_zoom);
+ player->setEyeHeight(m_prop.eye_height);
}
if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty())
m_prop.colors.clear();
m_prop.colors.emplace_back(255, 255, 255, 255);
m_prop.spritediv = v2s16(1,1);
+ m_prop.eye_height = 1.625f;
// end of default appearance
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;
v3f PlayerSAO::getEyeOffset() const
{
- return v3f(0, BS * 1.625f, 0);
+ return v3f(0, BS * m_prop.eye_height, 0);
}
std::string PlayerSAO::getDescription()
v3f LocalPlayer::getEyeOffset() const
{
- float eye_height = camera_barely_in_ceiling ? 1.5f : 1.625f;
+ float eye_height = camera_barely_in_ceiling ?
+ m_eye_height - 0.125f : m_eye_height;
return v3f(0, BS * eye_height, 0);
}
v3f getPosition() const { return m_position; }
v3f getEyePosition() const { return m_position + getEyeOffset(); }
v3f getEyeOffset() const;
+ void setEyeHeight(float eye_height) { m_eye_height = eye_height; }
void setCollisionbox(const aabb3f &box) { m_collisionbox = box; }
aabb3f m_collisionbox = aabb3f(-BS * 0.30f, 0.0f, -BS * 0.30f, BS * 0.30f,
BS * 1.75f, BS * 0.30f);
bool m_can_zoom = true;
+ float m_eye_height = 1.625f;
GenericCAO *m_cao = nullptr;
Client *m_client;
os << ", pointable=" << pointable;
os << ", can_zoom=" << can_zoom;
os << ", static_save=" << static_save;
+ os << ", eye_height=" << eye_height;
return os.str();
}
writeARGB8(os, color);
}
writeU8(os, collideWithObjects);
- writeF1000(os,stepheight);
+ writeF1000(os, stepheight);
writeU8(os, automatic_face_movement_dir);
writeF1000(os, automatic_face_movement_dir_offset);
writeU8(os, backface_culling);
writeU8(os, can_zoom);
writeS8(os, glow);
writeU16(os, breath_max);
+ writeF1000(os, eye_height);
// Add stuff only at the bottom.
// Never remove anything, because we don't want new versions of this
try {
glow = readS8(is);
breath_max = readU16(is);
+ eye_height = readF1000(is);
} catch (SerializationError &e) {}
}
//! For dropped items, this contains item information.
std::string wield_item;
bool static_save = true;
+ float eye_height = 1.625f;
ObjectProperties();
std::string dump();
if (getfloatfield(L, -1, "stepheight", prop->stepheight))
prop->stepheight *= BS;
getboolfield(L, -1, "can_zoom", prop->can_zoom);
+ getfloatfield(L, -1, "eye_height", prop->eye_height);
getfloatfield(L, -1, "automatic_rotate", prop->automatic_rotate);
lua_getfield(L, -1, "automatic_face_movement_dir");
lua_setfield(L, -2, "stepheight");
lua_pushboolean(L, prop->can_zoom);
lua_setfield(L, -2, "can_zoom");
-
+ lua_pushnumber(L, prop->eye_height);
+ lua_setfield(L, -2, "eye_height");
lua_pushnumber(L, prop->automatic_rotate);
lua_setfield(L, -2, "automatic_rotate");
if (prop->automatic_face_movement_dir)