diff options
author | sapier <Sapier at GMX dot net> | 2013-01-12 17:59:19 +0000 |
---|---|---|
committer | PilzAdam <pilzadam@minetest.net> | 2013-03-28 00:09:24 +0100 |
commit | 8800896824d609c754eee38d3720a112f4216e57 (patch) | |
tree | 31e0be737fa3883acb1559ab5e6ada7e35ba20fb /src/content_sao.cpp | |
parent | 880d9e53c39af1a7ca8b9ee5a9146708dabd5315 (diff) | |
download | minetest-8800896824d609c754eee38d3720a112f4216e57.tar.gz minetest-8800896824d609c754eee38d3720a112f4216e57.tar.bz2 minetest-8800896824d609c754eee38d3720a112f4216e57.zip |
Closed add object <-> object collision handling
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r-- | src/content_sao.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index d7afc31d8..468dfd218 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -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; +} |