4

We can make this a bit simpler using Minkowski addition. We can shrink one rectangle down to its center point, and enlarge the other rectangle from its center by the first's width and height, and get an equivalent situation: the two original rectangles overlap if and only if the shrunken point overlaps the new enlarged rectangle. Then we can just pick a new ...


3

Preface The answer from @DMGregory has some wonderful math that will most likely solve most if not all of your problems. While I would recommend working towards an implementation like theirs, I thought it would also be helpful to answer some of your other questions about why your code behaves the way it does. Q&A Q: When debugging, the collision check ...


1

When I first used box2d I quickly reached the 16 bits limit :-) Then I found a solution: you don't need to use all 16 bits, you need to categorize your objects. For example, you have some grounds and solid platforms, you put them in the SOLID category. You have many enemies, you put them in the ENEMY category. ... An enemy is an enemy regardless of its ...


Only top voted, non community-wiki answers of a minimum length are eligible