diff options
author | Mattes D <github@xoft.cz> | 2017-05-28 20:59:37 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-05-28 20:59:37 +0200 |
commit | bc6e2100c1cb5c695856e2a86afd202dec715967 (patch) | |
tree | 68a8099d937759373ee81e8a2ddc196bbf99144b /src | |
parent | Fixed tracer usage in Entity physics handling. (#3720) (diff) | |
download | cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.gz cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.bz2 cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.lz cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.xz cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.zst cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/LineBlockTracer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp index 42e827cb9..d23c5a09e 100644 --- a/src/LineBlockTracer.cpp +++ b/src/LineBlockTracer.cpp @@ -122,7 +122,11 @@ bool cLineBlockTracer::FirstSolidHitTrace( cBoundingBox bb(a_BlockX, a_BlockX + 1, a_BlockY, a_BlockY + 1, a_BlockZ, a_BlockZ + 1); // Bounding box of the block hit double LineCoeff = 0; // Used to calculate where along the line an intersection with the bounding box occurs eBlockFace Face; // Face hit - VERIFY(bb.CalcLineIntersection(m_Start, m_End, LineCoeff, Face)); + if (!bb.CalcLineIntersection(m_Start, m_End, LineCoeff, Face)) + { + // Math rounding errors have caused the calculation to miss the block completely, assume immediate hit + LineCoeff = 0; + } m_HitCoords = m_Start + (m_End - m_Start) * LineCoeff; // Point where projectile goes into the hit block return true; } |