finally fix corner case
This commit is contained in:
parent
c9d1f668cc
commit
09f1ca4e88
1 changed files with 4 additions and 5 deletions
|
@ -847,21 +847,20 @@ checkBoundsCollision2
|
||||||
-> V2 Double
|
-> V2 Double
|
||||||
checkBoundsCollision2
|
checkBoundsCollision2
|
||||||
pre@(V2 pr pc) nex dt acc (Boundaries (minr, minc) (maxr, maxc))
|
pre@(V2 pr pc) nex dt acc (Boundaries (minr, minc) (maxr, maxc))
|
||||||
| colltr < dt && colltc < dt = V2 0 0
|
|
||||||
| colltr < dt || colltc < dt = V2 0 0
|
| colltr < dt || colltc < dt = V2 0 0
|
||||||
| otherwise = acc
|
| otherwise = acc
|
||||||
where
|
where
|
||||||
V2 vr vc = fmap (/ dt) (nex - pre)
|
V2 vr vc = fmap (/ dt) (nex - pre)
|
||||||
colltr
|
colltr
|
||||||
| vr > 0 && prr < maxr && (prc > minc && prc < maxc) =
|
| vr > 0 && prr <= maxr && (prc >= minc && prc <= maxc) =
|
||||||
((fromIntegral (floor pr :: Int) + minr - 0.15) - pr) / vr
|
((fromIntegral (floor pr :: Int) + minr - 0.15) - pr) / vr
|
||||||
| vr < 0 && prr > minr && (prc > minc && prc < maxc) =
|
| vr < 0 && prr >= minr && (prc >= minc && prc <= maxc) =
|
||||||
((fromIntegral (floor pr :: Int) + maxr + 0.15) - pr) / vr
|
((fromIntegral (floor pr :: Int) + maxr + 0.15) - pr) / vr
|
||||||
| otherwise = dt
|
| otherwise = dt
|
||||||
colltc
|
colltc
|
||||||
| vc > 0 && prc < maxc && (prr > minr && prr < maxr) =
|
| vc > 0 && prc <= maxc && (prr >= minr && prr <= maxr) =
|
||||||
((fromIntegral (floor pc :: Int) + minc - 0.15) - pc) / vc
|
((fromIntegral (floor pc :: Int) + minc - 0.15) - pc) / vc
|
||||||
| vc < 0 && prc > minc && (prr > minr && prr < maxr) =
|
| vc < 0 && prc >= minc && (prr >= minr && prr <= maxr) =
|
||||||
((fromIntegral (floor pc :: Int) + maxc + 0.15) - pc) / vc
|
((fromIntegral (floor pc :: Int) + maxc + 0.15) - pc) / vc
|
||||||
| otherwise = dt
|
| otherwise = dt
|
||||||
prr = pr - fromIntegral (floor pr :: Int)
|
prr = pr - fromIntegral (floor pr :: Int)
|
||||||
|
|
Loading…
Reference in a new issue