+#ifdef __FAST_MATH__
+#warning "-ffast-math is known to cause bugs in collision code, do not use!"
+#endif
+
+struct NearbyCollisionInfo {
+ // node
+ NearbyCollisionInfo(bool is_ul, int bouncy, const v3s16 &pos,
+ const aabb3f &box) :
+ is_unloaded(is_ul),
+ obj(nullptr),
+ bouncy(bouncy),
+ position(pos),
+ box(box)
+ {}
+
+ // object
+ NearbyCollisionInfo(ActiveObject *obj, int bouncy,
+ const aabb3f &box) :
+ is_unloaded(false),
+ obj(obj),
+ bouncy(bouncy),
+ box(box)
+ {}
+
+ inline bool isObject() const { return obj != nullptr; }
+
+ bool is_unloaded;
+ bool is_step_up = false;
+ ActiveObject *obj;
+ int bouncy;
+ v3s16 position;
+ aabb3f box;
+};
+
+// Helper functions:
+// Truncate floating point numbers to specified number of decimal places
+// in order to move all the floating point error to one side of the correct value
+static inline f32 truncate(const f32 val, const f32 factor)
+{
+ return truncf(val * factor) / factor;
+}
+
+static inline v3f truncate(const v3f& vec, const f32 factor)
+{
+ return v3f(
+ truncate(vec.X, factor),
+ truncate(vec.Y, factor),
+ truncate(vec.Z, factor)
+ );
+}