"Sticky Ball" Implementation Approach

Hello,

I'm currently trying to implement a "sticky ball" sort of game. A user controlled ball rolls around and when it hits other balls, they stick to it and the accumulated mass rolls around together (think Katamari Damacy). I'm currently trying to decide on two different approaches:

1. On contact, create very stiff prismatic joints.

2. On contact, merge the two bodies in some way (either recreate a unified body from the shapes of both objects, or add the shape of the contacted-with body to the main player body).

I've currently got it semi working using the first approach, but the glued-together bodies become difficult to manage - mostly because all of the accumulated bodies all have separate contact lists. It would be easier if I could just inspect the contact list of one body.

So... has anyone been successful in dynamically adding shapes to existing bodies? Is their another approach that may be easier than either of these methods? I'm just looking for suggestions.

Thanks!
I'm not sure if it's completely finished, but the newest revision in the SVN has add/remove shapes from bodies as a feature.

I don't understand what you mean exactly by the bodies becoming difficult to manage.
brainclog wrote:
I'm not sure if it's completely finished, but the newest revision in the SVN has add/remove shapes from bodies as a feature.


Man that would be perfect. I don't think it's made its way into the ActionScript port yet though. :/

brainclog wrote:
I don't understand what you mean exactly by the bodies becoming difficult to manage.


Once the bodies get stuck together, I'd like to be able to simply control the accumulated mass as a single object (i.e. apply rotation, respond to contacts, etc.), that's all. Not a huge hurdle to get over.
Probably easiest to recreate the body for now.

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