I have a resizing set of bounding rectangles surrounding a set of actors within a ClutterBox2D object. The size of the bounding region varies as new element are added to the group. Attempting to simply resize/reposition the bounding actors resulted in the display to show correctly, but the Box2D physics was calculating collisions based on the size of the actors when they were added to the Box2D group. I'm not sure why the Box2D physics world wasn't being sync'd correctly... and so I tried a different approach.
I changed my code to create a new set of bounding elements, and delete the old ones after the new ones are added to the ClutterBox2D actor. However, in this case, clutter-box2d wasn't actually removing the Box2D body from the world when the actor contained in the ClutterBox2D was removed.
The attached patch attempts to fix that behavior by calling DestroyBody in clutter_box2d_destroy_child_meta.
James
Destroy Box2D body when Actor is destroyed The Box2D body associated with a child was not being destroyed when an Actor was destroyed, resulting in collisions continuing to occur with the (now missing) Actor. Signed-off-by: James Ketrenos <[EMAIL PROTECTED]> --- clutter-box2d/clutter-box2d.cpp (revision 3257) +++ clutter-box2d/clutter-box2d.cpp (working copy) @@ -279,6 +279,8 @@ g_hash_table_remove (CLUTTER_BOX2D (box2d)->actors, actor); g_hash_table_remove (CLUTTER_BOX2D (box2d)->bodies, box2d_actor->body); + + box2d_actor->world->DestroyBody (box2d_actor->body); } static ClutterChildMeta *
