From 8800896824d609c754eee38d3720a112f4216e57 Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 12 Jan 2013 17:59:19 +0000 Subject: Closed add object <-> object collision handling --- src/content_cao.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/content_cao.cpp') diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 269667fe5..ee1009b6c 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -174,6 +174,7 @@ public: void processMessage(const std::string &data); + bool getCollisionBox(aabb3f *toset) { return false; } private: scene::IMeshSceneNode *m_node; v3f m_position; @@ -329,6 +330,7 @@ public: std::string infoText() {return m_infotext;} + bool getCollisionBox(aabb3f *toset) { return false; } private: core::aabbox3d m_selection_box; scene::IMeshSceneNode *m_node; @@ -643,6 +645,22 @@ public: ClientActiveObject::registerType(getType(), create); } + bool getCollisionBox(aabb3f *toset) { + if (m_prop.physical) { + aabb3f retval; + //update collision box + toset->MinEdge = m_prop.collisionbox.MinEdge * BS; + toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS; + + toset->MinEdge += m_position; + toset->MaxEdge += m_position; + + return true; + } + + return false; + } + void initialize(const std::string &data) { infostream<<"GenericCAO: Got init data"<getGameDef(); - moveresult = collisionMoveSimple(&env->getMap(), gamedef, + moveresult = collisionMoveSimple(env,env->getGameDef(), pos_max_d, box, stepheight, dtime, p_pos, p_velocity, p_acceleration); // Apply results -- cgit v1.2.3