summaryrefslogtreecommitdiff
path: root/src/content_cao.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-01-12 17:59:19 +0000
committerPilzAdam <pilzadam@minetest.net>2013-03-28 00:09:24 +0100
commit8800896824d609c754eee38d3720a112f4216e57 (patch)
tree31e0be737fa3883acb1559ab5e6ada7e35ba20fb /src/content_cao.cpp
parent880d9e53c39af1a7ca8b9ee5a9146708dabd5315 (diff)
downloadminetest-8800896824d609c754eee38d3720a112f4216e57.tar.gz
minetest-8800896824d609c754eee38d3720a112f4216e57.tar.bz2
minetest-8800896824d609c754eee38d3720a112f4216e57.zip
Closed add object <-> object collision handling
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r--src/content_cao.cpp21
1 files changed, 19 insertions, 2 deletions
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<f32> 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"<<std::endl;
@@ -1127,8 +1145,7 @@ public:
v3f p_pos = m_position;
v3f p_velocity = m_velocity;
v3f p_acceleration = m_acceleration;
- IGameDef *gamedef = env->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