nonsticky walls

This commit is contained in:
nek0 2018-05-14 18:00:18 +02:00
parent 4226265030
commit cc3480c0c0

View file

@ -380,12 +380,14 @@ checkBoundsCollision2
where where
vel@(V2 vr vc) = fmap (/ dt) (next - pre) vel@(V2 vr vc) = fmap (/ dt) (next - pre)
colltr colltr
| vr > 0 = (((fromIntegral (floor pr :: Int)) + minr - 0.15) - pr) / vr | vr > 0 && prr <= maxr = (((fromIntegral (floor pr :: Int)) + minr - 0.15) - pr) / vr
| vr < 0 = (((fromIntegral (floor pr :: Int)) + maxr + 0.15) - pr) / vr | vr < 0 && prr >= minr = (((fromIntegral (floor pr :: Int)) + maxr + 0.15) - pr) / vr
| otherwise = dt | otherwise = dt
colltc colltc
| vc > 0 = (((fromIntegral (floor pc :: Int)) + minc - 0.15) - pc) / vc | vc > 0 && prc <= maxc = (((fromIntegral (floor pc :: Int)) + minc - 0.15) - pc) / vc
| vc < 0 = (((fromIntegral (floor pc :: Int)) + maxc + 0.15) - pc) / vc | vc < 0 && prc >= minc = (((fromIntegral (floor pc :: Int)) + maxc + 0.15) - pc) / vc
| otherwise = dt | otherwise = dt
inrow = pr > minr && pr < maxr inrow = pr > minr && pr < maxr
incol = pc > minc && pc < maxc incol = pc > minc && pc < maxc
prr = pr - (fromIntegral $ floor pr)
prc = pc - (fromIntegral $ floor pc)