1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Closed add object <-> object collision handling

This commit is contained in:
sapier 2013-01-12 17:59:19 +00:00 committed by PilzAdam
parent 880d9e53c3
commit 8800896824
10 changed files with 157 additions and 33 deletions

View file

@ -64,6 +64,10 @@ public:
infostream<<"DummyLoadSAO step"<<std::endl;
}
bool getCollisionBox(aabb3f *toset) {
return false;
}
private:
};
@ -132,6 +136,10 @@ public:
}
}
bool getCollisionBox(aabb3f *toset) {
return false;
}
private:
float m_timer1;
float m_age;
@ -208,8 +216,7 @@ public:
v3f pos_f_old = pos_f;
v3f accel_f = v3f(0,0,0);
f32 stepheight = 0;
IGameDef *gamedef = m_env->getGameDef();
moveresult = collisionMoveSimple(&m_env->getMap(), gamedef,
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
pos_max_d, box, stepheight, dtime,
pos_f, m_speed_f, accel_f);
@ -314,6 +321,10 @@ public:
return 0;
}
bool getCollisionBox(aabb3f *toset) {
return false;
}
private:
std::string m_itemstring;
@ -490,8 +501,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
v3f p_pos = m_base_position;
v3f p_velocity = m_velocity;
v3f p_acceleration = m_acceleration;
IGameDef *gamedef = m_env->getGameDef();
moveresult = collisionMoveSimple(&m_env->getMap(), gamedef,
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
pos_max_d, box, stepheight, dtime,
p_pos, p_velocity, p_acceleration);
// Apply results
@ -880,6 +890,22 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
m_messages_out.push_back(aom);
}
bool LuaEntitySAO::getCollisionBox(aabb3f *toset) {
if (m_prop.physical)
{
//update collision box
toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
toset->MinEdge += m_base_position;
toset->MaxEdge += m_base_position;
return true;
}
return false;
}
/*
PlayerSAO
*/
@ -1434,3 +1460,7 @@ std::string PlayerSAO::getPropertyPacket()
return gob_cmd_set_properties(m_prop);
}
bool PlayerSAO::getCollisionBox(aabb3f *toset) {
//player collision handling is already done clientside no need to do it twice
return false;
}