summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-04-21 12:05:06 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-04-21 12:07:27 -0700
commit96a5354401916dc7f5e448de7dc0348346141035 (patch)
treeacc9f07a45ded221bda33a0aabd7450863c7b52d
parentd3a061b1f94c99848a058db1cecd89c81aad4f77 (diff)
game: fix typo in any_aabb initializationrev1
Missing comma silently resulted in aabb_any.min.x == -2 Excellent example of how using the same syntax for negative and the subtraction operator creates opportunity for silent bugs. This is the first time this particular thing has bitten me, doing mostly systems programming throughout my life I haven't dealt much with negative values and certainly not frequently initializing bags of them as is common in game development. This bug is why the collision hit boxes seemed so huge, it was only on the horizontal axis, and actually just the minimum side but in-play it appears to be both since there's always a minimum involved on a horizontal collision. Sigh.
-rw-r--r--src/game.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/game.c b/src/game.c
index 39dbf10..6665d4d 100644
--- a/src/game.c
+++ b/src/game.c
@@ -66,7 +66,7 @@
/* every entity just starts with a unit cube AABB and is transformed with a matrix into its position,
* so here's a convenient aabb to feed into those transformations as needed.
*/
-static const bb3f_t any_aabb = { .min = { -1.f -1.f, -1.f}, .max = { 1.f, 1.f, 1.f } };
+static const bb3f_t any_aabb = { .min = { -1.f, -1.f, -1.f }, .max = { 1.f, 1.f, 1.f } };
typedef enum game_state_t {
GAME_STATE_PLAYING,
© All Rights Reserved