diff --git a/src/Test.hs b/src/Test.hs index 35235c2..eb67f5b 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -359,17 +359,17 @@ checkBoundsCollision2 -> V2 Double checkBoundsCollision2 pre@(V2 pr pc) next@(V2 nr nc) dt acc (Boundaries (minr, minc) (maxr, maxc)) - | colltr > dt && colltc > dt = acc - | colltr > dt = (V2 0 1) * acc - | colltc > dt = (V2 1 0) * acc + | (colltr >= dt || abs colltr > 0.1) && (colltc >= dt || abs colltc > 0.1) = acc + | (colltr >= dt || abs colltr > 0.1) = (V2 1 0) * acc + | (colltc >= dt || abs colltc > 0.1) = (V2 0 1) * acc | otherwise = V2 0 0 where vel@(V2 vr vc) = fmap (/ dt) (next - pre) colltr - | vr > 0 = (((fromIntegral (floor nr :: Int)) + minr) - nr) / vr - | vr < 0 = (((fromIntegral (floor nr :: Int)) + maxr) - nr) / vr + | vr > 0 = (((fromIntegral (floor nr :: Int)) + minr - 0.15) - nr) / vr + | vr < 0 = (((fromIntegral (floor nr :: Int)) + maxr + 0.15) - nr) / vr | otherwise = dt colltc - | vc > 0 = (((fromIntegral (floor nc :: Int)) + minc) - nc) / vc - | vc < 0 = (((fromIntegral (floor nc :: Int)) + maxc) - nc) / vc + | vc > 0 = (((fromIntegral (floor nc :: Int)) + minc - 0.15) - nc) / vc + | vc < 0 = (((fromIntegral (floor nc :: Int)) + maxc + 0.15) - nc) / vc | otherwise = dt