First off, thanks to Erin for such an excellent 2D physics simulator, and thanks to BorisTheBrave and mayobutter for their Flash efforts.
I'm currently using the Alchemy port of Box2D (just the basic port, not WCK)
I'm trying to create "springy" bodies - basically bubbles that are allowed to overlap but when they do they exert pressure on each other relative to the overlap area. So, if a character jumps on a pile of bubbles, they should sink down into each other and then spring back up when the character jumps off of them.
The approach I was at first considering is to make each bubble a sensor, and then go through the contact list between timesteps and apply the appropriate amount of force to each overlapping bubble pair. The only problem is that the character (and other "solid" objects) should not sink into the bubbles, and the bubbles shouldn't sink into the ground.
So - is this an area where I should add an ContactEvent listener to each bubble's fixture? Should I listen to POST_SOLVE, and modify the impulse within the event handler? Or is POST_SOLVE too late for that?
Also, the bubbles can grow in size over time and then pop. Currently I am destroying the fixture and recreating it - which means I'll have to reattach the ContactEvent listener as well. I'm a little concerned about performance - does the Alchemy port provide a way to resize fixtures without destroying/recreating them each timestep?
I'm currently using the Alchemy port of Box2D (just the basic port, not WCK)
I'm trying to create "springy" bodies - basically bubbles that are allowed to overlap but when they do they exert pressure on each other relative to the overlap area. So, if a character jumps on a pile of bubbles, they should sink down into each other and then spring back up when the character jumps off of them.
The approach I was at first considering is to make each bubble a sensor, and then go through the contact list between timesteps and apply the appropriate amount of force to each overlapping bubble pair. The only problem is that the character (and other "solid" objects) should not sink into the bubbles, and the bubbles shouldn't sink into the ground.
So - is this an area where I should add an ContactEvent listener to each bubble's fixture? Should I listen to POST_SOLVE, and modify the impulse within the event handler? Or is POST_SOLVE too late for that?
Also, the bubbles can grow in size over time and then pop. Currently I am destroying the fixture and recreating it - which means I'll have to reattach the ContactEvent listener as well. I'm a little concerned about performance - does the Alchemy port provide a way to resize fixtures without destroying/recreating them each timestep?