simplify collision detection

This commit is contained in:
nek0 2018-04-30 20:34:45 +02:00
parent f6860c1332
commit e444c03c33

View file

@ -305,21 +305,17 @@ checkBoundsCollision
| otherwise = V2 (0 * mr) (0 * mc)
where
ntestr
| ndistr <= hheight + 0.15 = True
= ndistr <= hheight + 0.15
-- | ncdistsq <= 0.005 = True
| otherwise = False
ntestc
| ndistc <= hwidth + 0.15 = True
= ndistc <= hwidth + 0.15
-- | ncdistsq <= 0.005 = True
| otherwise = False
testr
| distr <= hheight + 0.15 = True
= distr <= hheight + 0.15
-- | cdistsq <= 0.005 = True
| otherwise = False
testc
| distc <= hwidth + 0.15 = True
= distc <= hwidth + 0.15
-- | cdistsq <= 0.005 = True
| otherwise = False
ndistr = abs (fr - (fromIntegral (floor fr :: Int) + (minr + hheight)))
ndistc = abs (fc - (fromIntegral (floor fc :: Int) + (minc + hwidth)))
distr = abs (pr - (fromIntegral (floor fr :: Int) + (minr + hheight)))