]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/collision.cpp
Bunch of small fixes (coding style, very unlikely errors, warning messages)
[dragonfireclient.git] / src / collision.cpp
index df3878f4c6c26dcdb638bbcb6cf4a179021d9727..76696e90db7deb8db0fd431f1a17b35d19c39743 100644 (file)
@@ -32,7 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "profiler.h"
 
 // float error is 10 - 9.96875 = 0.03125
-#define COLL_ZERO 0.032
+//#define COLL_ZERO 0.032 // broken unit tests
+#define COLL_ZERO 0
 
 // Helper function:
 // Checks for collision of a moving aabbox with a static aabbox
@@ -195,7 +196,9 @@ 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,ActiveObject* self)
+               v3f &pos_f, v3f &speed_f,
+               v3f &accel_f,ActiveObject* self,
+               bool collideWithObjects)
 {
        Map *map = &env->getMap();
        //TimeTaker tt("collisionMoveSimple");
@@ -286,6 +289,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
        }
        } // tt2
 
+       if(collideWithObjects)
        {
                ScopeProfiler sp(g_profiler, "collisionMoveSimple objects avg", SPT_AVG);
                //TimeTaker tt3("collisionMoveSimple collect object boxes");
@@ -333,7 +337,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
                        if (object != NULL)
                        {
                                aabb3f object_collisionbox;
-                               if (object->getCollisionBox(&object_collisionbox))
+                               if (object->getCollisionBox(&object_collisionbox) &&
+                                               object->collideWithObjects())
                                {
                                        cboxes.push_back(object_collisionbox);
                                        is_unloaded.push_back(false);