Bodies with multiple shapes freezing too early

Image

In the above image, the green line is the world boundary, and the body freezes the moment the first shape that is part of the body is completely outside the world boundary. Other shapes that touch the pieces still within the world bounds still collide, though, which could be problematic. The engine is freezing bodies as soon as one of the shapes bounding boxes is out of range, rather than waiting until they are all out of range. The fix is probably in b2Poly/b2CircleShape::Synchronize, by adding a check to see if all the shapes attached to the body are out of range before freezing.
That sounds good. This whole freezing thing is tricky business. I have been inclined to get rid of the world AABB by going from shorts to floats in the broad-phase, but I'm concerned that memory usage is important on some platforms.
Maybe provide the option of using the AABB
if it's not too hard and doesn't complicate the api?
Mike
Have you ever benchmarked the speed difference between using floats and shorts? I was always under the impression that beyond using less memory, it would actually be a bit quicker to use shorts, though I've never actually checked it (we use ints in JBox2d because in Java - ridiculously, IMO - bytes, shorts, and ints all take up the same amount of space, so we might as well retain the extra accuracy...)

I would suggest considering a multi-SAP if the finite world boundary thing really bothers you and you would prefer to stick with shorts - this requires some matching across the region boundaries and gives you a couple more parameters to tune, but should significantly speed up adds/deletes if the region sizes are well chosen. It is a pretty major complication to the broadphase, though, maybe best left to a future version.

I think most people are satisfied with the broadphase as-is. I don't mind the freezing, and for most applications I don't think you really need a truly open-ended world.
Integer comparisons are faster than floating point comparisons. So we get space and time benefits by using shorts. I think I'll stick with shorts. All the bugs should be gone eventually. 🙂

Multi-SAP still needs a world AABB to encompass the sub-SAPs, so there is still a lot of complexity.

I will do some performance investigation of the broad-phase eventually, but for now I'm more concerned with features.
I'm now starting to reconsider using floats in the SAP. It seems that a lot of people are running into trouble with it and I'd rather stop supporting this issue and focus on other things.

Any objections? Anyone?
Honestly, whatever you decide is fine with me, I've never actually had any real problems using the thing that I couldn't work around somewhat easily.
Okay, this is fixed in SVN. I'll hold on floats for now.

Original thread: https://box2d.org/forum/viewtopic.php?t=117