diff options
author | sapier <Sapier at GMX dot net> | 2013-04-09 23:16:13 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2013-04-09 23:16:13 +0200 |
commit | 6e4fdf37baaeaf1048210e5519822ebd68dd413b (patch) | |
tree | c3ed76bc45da980437f64689bd4c3b66d5c96fdc /src/collision.cpp | |
parent | 7d002b60ff3d672d141e0de65702c8af5b60f83a (diff) | |
download | minetest-6e4fdf37baaeaf1048210e5519822ebd68dd413b.tar.gz minetest-6e4fdf37baaeaf1048210e5519822ebd68dd413b.tar.bz2 minetest-6e4fdf37baaeaf1048210e5519822ebd68dd413b.zip |
fix objects colliding with its own collision boxes
Diffstat (limited to 'src/collision.cpp')
-rw-r--r-- | src/collision.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/collision.cpp b/src/collision.cpp index cd170196f..673966b6e 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -192,7 +192,7 @@ bool wouldCollideWithCeiling( collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, f32 pos_max_d, const aabb3f &box_0, f32 stepheight, f32 dtime, - v3f &pos_f, v3f &speed_f, v3f &accel_f) + v3f &pos_f, v3f &speed_f, v3f &accel_f,ActiveObject* self) { Map *map = &env->getMap(); //TimeTaker tt("collisionMoveSimple"); @@ -300,7 +300,9 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, c_env->getActiveObjects(pos_f,distance * 1.5,clientobjects); for (int i=0; i < clientobjects.size(); i++) { - objects.push_back((ActiveObject*)clientobjects[i].obj); + if ((self == 0) || (self != clientobjects[i].obj)) { + objects.push_back((ActiveObject*)clientobjects[i].obj); + } } } else @@ -314,7 +316,9 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, for (std::set<u16>::iterator iter = s_objects.begin(); iter != s_objects.end(); iter++) { ServerActiveObject *current = s_env->getActiveObject(*iter); - objects.push_back((ActiveObject*)current); + if ((self == 0) || (self != current)) { + objects.push_back((ActiveObject*)current); + } } } } @@ -458,8 +462,9 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, if (is_object[nearest_boxindex]) { info.type = COLLISION_OBJECT; } - else + else { info.type = COLLISION_NODE; + } info.node_p = node_positions[nearest_boxindex]; info.bouncy = bouncy; info.old_speed = speed_f; |