Sometimes happens it is necessary to disable (disable collision, disable move, disable joint etc.) temporarily any bodies.
b2Body::PutSleep does not approach for this purpose since bodies continue to participate in collision-detection.
One of decisions - time removal such bodies. But a reconstruction of a body is very difficult because of necessity restoration its all parameters.
For the decision of this problem I have added to a body methods b2Body::Freeze() and b2Body::UnFreeze().
b2Body::Freeze(): temporary delete this body and bodies connected to it by joints.
b2Body::Freeze(): restore body and bodies connected to it by joints.
I did platformer-style game and have faced a problem "b2Assert (m_proxyCount <b2_maxProxies) ". In game the big world, but only a small part of the world it is visible during each moment of time.
For the decision of this problem I disconnect objects which are not crossed with the active area (display screen).
For this purpose I have made the new controller - b2PVSController. It call method b2Body::Freeze to the objects which are being behind borders of active area (display screen). For detection overlap it uses new functionality of b2Body - b2Body::GetAABB(). But it is possible to use other ways - center of body or all body shapes aabb.
I hope you find this useful, and that you might consider adding it to a future release.
Sorry for my bad english.
b2Body::PutSleep does not approach for this purpose since bodies continue to participate in collision-detection.
One of decisions - time removal such bodies. But a reconstruction of a body is very difficult because of necessity restoration its all parameters.
For the decision of this problem I have added to a body methods b2Body::Freeze() and b2Body::UnFreeze().
b2Body::Freeze(): temporary delete this body and bodies connected to it by joints.
b2Body::Freeze(): restore body and bodies connected to it by joints.
I did platformer-style game and have faced a problem "b2Assert (m_proxyCount <b2_maxProxies) ". In game the big world, but only a small part of the world it is visible during each moment of time.
For the decision of this problem I disconnect objects which are not crossed with the active area (display screen).
For this purpose I have made the new controller - b2PVSController. It call method b2Body::Freeze to the objects which are being behind borders of active area (display screen). For detection overlap it uses new functionality of b2Body - b2Body::GetAABB(). But it is possible to use other ways - center of body or all body shapes aabb.
I hope you find this useful, and that you might consider adding it to a future release.
Attachment:
All changes based on revision 188 of repository.Sorry for my bad english.