forked from Mirrorlandia_minetest/minetest
Make the player collisionbox settable
This commit is contained in:
parent
43d1f375d1
commit
b6f4a9c7e1
@ -3705,7 +3705,8 @@ Definition tables
|
|||||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
||||||
visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
|
visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
|
||||||
visual_size = {x=1, y=1},
|
visual_size = {x=1, y=1},
|
||||||
mesh = "model",
|
mesh = "model", -- for players (0, -1, 0) is ground level,
|
||||||
|
-- for all other entities (0, 0, 0) is ground level.
|
||||||
textures = {}, -- number of required textures depends on visual
|
textures = {}, -- number of required textures depends on visual
|
||||||
colors = {}, -- number of required colors depends on visual
|
colors = {}, -- number of required colors depends on visual
|
||||||
spritediv = {x=1, y=1},
|
spritediv = {x=1, y=1},
|
||||||
|
@ -1585,7 +1585,13 @@ void GenericCAO::processMessage(const std::string &data)
|
|||||||
}
|
}
|
||||||
if (m_is_local_player) {
|
if (m_is_local_player) {
|
||||||
LocalPlayer *player = m_env->getLocalPlayer();
|
LocalPlayer *player = m_env->getLocalPlayer();
|
||||||
|
|
||||||
player->makes_footstep_sound = m_prop.makes_footstep_sound;
|
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 == "")
|
if ((m_is_player && !m_is_local_player) && m_prop.nametag == "")
|
||||||
|
@ -1429,7 +1429,10 @@ bool PlayerSAO::checkMovementCheat()
|
|||||||
|
|
||||||
bool PlayerSAO::getCollisionBox(aabb3f *toset) const
|
bool PlayerSAO::getCollisionBox(aabb3f *toset) const
|
||||||
{
|
{
|
||||||
*toset = aabb3f(-BS * 0.30, 0.0, -BS * 0.30, BS * 0.30, BS * 1.75, BS * 0.30);
|
//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->MinEdge += m_base_position;
|
toset->MinEdge += m_base_position;
|
||||||
toset->MaxEdge += m_base_position;
|
toset->MaxEdge += m_base_position;
|
||||||
return true;
|
return true;
|
||||||
|
@ -137,6 +137,8 @@ public:
|
|||||||
v3f getEyePosition() const { return m_position + getEyeOffset(); }
|
v3f getEyePosition() const { return m_position + getEyeOffset(); }
|
||||||
v3f getEyeOffset() const;
|
v3f getEyeOffset() const;
|
||||||
|
|
||||||
|
void setCollisionbox(aabb3f box) { m_collisionbox = box; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
|
void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
|
||||||
void accelerateVertical(const v3f &target_speed, const f32 max_increase);
|
void accelerateVertical(const v3f &target_speed, const f32 max_increase);
|
||||||
|
Loading…
Reference in New Issue
Block a user