I am creating a side-scroller game. How should I go about incorporating Box2D? Should I create the world such that its AABB encapsulates the entire span of the level (could be some seriously huge levels)? Or should I somehow adjust things as the player progress through?
side-scroller loading in of physics?
General DiscussionThe world AABB has 16bits of resolution. So what happens when you make a very large world is that bounding boxes become fatter. So for example, if you use a world size of 1km by 1km, then the smallest bounding box dimension is 1000 / 2^16 meters = 1.53 centimeters. If most of your shapes are larger than a centimeter than this is no problem. If most of your shapes are less than one millimeter, then your bounding boxes will be excessively large, leading to reduced performance.
If you find that your world is still too big, then you should consider having junction where the old physics world is destroyed and a new physics world is created.
If you find that your world is still too big, then you should consider having junction where the old physics world is destroyed and a new physics world is created.
Original thread: https://box2d.org/forum/viewtopic.php?t=250