collide_with_objects = true, -- collide with other objects if physical = true
weight = 5,
collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
- -- ^ For players (0, -1, 0) is at object base level,
- -- for all other objects (0, 0, 0) is at object base level.
- -- For example, Minetest Game player box is (-0.3, -1.0, -0.3, 0.3, 0.75, 0.3).
visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem",
visual_size = {x = 1, y = 1},
mesh = "model",
// Maximum hit points of a player
#define PLAYER_MAX_HP 20
-// Player weight
-#define PLAYER_DEFAULT_WEIGHT 75
-
-// Player step height
-#define PLAYER_DEFAULT_STEPHEIGHT 0.6f
-
// Maximal breath of a player
#define PLAYER_MAX_BREATH 11
}
if (m_is_local_player) {
LocalPlayer *player = m_env->getLocalPlayer();
-
player->makes_footstep_sound = m_prop.makes_footstep_sound;
-
- aabb3f collisionbox = m_selection_box;
- collisionbox.MinEdge += v3f(0, BS, 0);
- collisionbox.MaxEdge += v3f(0, BS, 0);
- player->setCollisionbox(collisionbox);
}
if ((m_is_player && !m_is_local_player) && m_prop.nametag == "")
scene::IBillboardSceneNode *getSpriteSceneNode();
-
- inline f32 getStepheight() const
- {
- return m_prop.stepheight;
- }
-
inline bool isPlayer() const
{
return m_is_player;
m_prop.hp_max = PLAYER_MAX_HP;
m_prop.physical = false;
- m_prop.weight = PLAYER_DEFAULT_WEIGHT;
+ m_prop.weight = 75;
m_prop.collisionbox = aabb3f(-0.3f, -1.0f, -0.3f, 0.3f, 0.75f, 0.3f);
// start of default appearance, this should be overwritten by LUA
m_prop.visual = "upright_sprite";
// end of default appearance
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;
- m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT;
m_hp = PLAYER_MAX_HP;
}
bool PlayerSAO::getCollisionBox(aabb3f *toset) const
{
- //update collision box
- toset->MinEdge = m_prop.collisionbox.MinEdge * BS + v3f(0, BS, 0);
- toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS + v3f(0, BS, 0);
+ *toset = aabb3f(-0.3f * BS, 0.0f, -0.3f * BS, 0.3f * BS, 1.75f * BS, 0.3f * BS);
toset->MinEdge += m_base_position;
toset->MaxEdge += m_base_position;
}
}
- float player_stepheight = (m_cao == 0) ? 0.0f :
- ((touching_ground) ? m_cao->getStepheight() : (0.2f * BS));
+ // TODO: this shouldn't be hardcoded but transmitted from server
+ float player_stepheight = (touching_ground) ? (BS * 0.6f) : (BS * 0.2f);
#ifdef __ANDROID__
player_stepheight += (0.6f * BS);
v3f getEyePosition() const { return m_position + getEyeOffset(); }
v3f getEyeOffset() const;
- void setCollisionbox(aabb3f box) { m_collisionbox = box; }
-
private:
void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
void accelerateVertical(const v3f &target_speed, const f32 max_increase);