aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Spear/Collision.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/Spear/Collision.hs b/Spear/Collision.hs
index 9c538ae..fb8f11e 100644
--- a/Spear/Collision.hs
+++ b/Spear/Collision.hs
@@ -40,15 +40,13 @@ class Collisionable a where
40instance Collisionable AABB where 40instance Collisionable AABB where
41 41
42 collideBox box1@(AABB min1 max1) box2@(AABB min2 max2) 42 collideBox box1@(AABB min1 max1) box2@(AABB min2 max2)
43 | min1 > max2 = NoCollision
44 | max1 < min2 = NoCollision
45 | box1 `aabbpt` min2 && box1 `aabbpt` max2 = FullyContains
46 | box2 `aabbpt` min1 && box2 `aabbpt` max1 = FullyContainedBy
47 | (x max1) < (x min2) = NoCollision 43 | (x max1) < (x min2) = NoCollision
48 | (x min1) > (x max2) = NoCollision 44 | (x min1) > (x max2) = NoCollision
49 | (y max1) < (y min2) = NoCollision 45 | (y max1) < (y min2) = NoCollision
50 | (y min1) > (y max2) = NoCollision 46 | (y min1) > (y max2) = NoCollision
51 | otherwise = Collision 47 | box1 `aabbpt` min2 && box1 `aabbpt` max2 = FullyContains
48 | box2 `aabbpt` min1 && box2 `aabbpt` max1 = FullyContainedBy
49 | otherwise = Collision
52 50
53 collideCircle sphere@(Circle c r) aabb@(AABB min max) 51 collideCircle sphere@(Circle c r) aabb@(AABB min max)
54 | test == FullyContains || test == FullyContainedBy = test 52 | test == FullyContains || test == FullyContainedBy = test