body shape change for animated sprite?

Hello,

I have an animated sprite with each frame very different (running dog) and want each frame to have a different b2body shape. Currently have a simple box around him (the animation).

The dog animation sometimes has all legs under him and other frames the legs are spread.
I notice if the dog is sitting on curved rocks (a b2body) with legs apart he floats in mid air or rocks back and forth on top of it. I have a simple box shape set around him so it makes sense.

Would like his interaction with rocks to be more realistic (i.e. if he encounters a b2body of a rock between his front and back legs that he straddles the rock).

Advice?

Forgot to mention that I tried using b2RevoluteJoint for the dog's legs/body but the linkage kept stretching when encountering rocks.
I'm afraid I don't have any great solution for you, but I *do* know of a game that has a really well-done physics-based dog; possibly you could try emailing one of the authors to ask them about it?

http://www.youtube.com/watch?v=_hsLFV3kwvs
You're going to need to do something similar to what Intrusion was going: You're going to need to use some geometry to represent the legs (intrusion uses a circle for each foot on the wolf, later in the demo they show it off), that is distinct from the body.
Good idea, raigan! I'll try that.

Very nice animation and example, thank you.

@ John - Seems like the body/neck has a joint but the feet seem to have "floating" kinematic bodies not connected to anything. Not sure how it is possible to have the circles distinct from the body ...

Today, I've been basically destroying/recreating distinct bodies (and shapesdefs) for each animation frame every 10 ticks or so. Doing the destroying/recreating all in the tick.

Thought I read this was bad and it certainly isn't looking good. I keep having each body briefly appearing at the origin for each destroy/recreate causing a bad flicker and performance issues.

Would surely appreciate anyone taking time with more thoughts on how this can be done.
Isolated the animation frame briefly appearing at 0,0.
Appears to happen at this call in CCDirector.m

Code:
/* swap buffers */
[openGLView_ swapBuffers];


The next animation body/fixture/sprite pops to 0,0 for one time step when this get's called.

Hmmm ... not sure what to do with this info ...
Hi Paj,
How did you approach this finally?
In my case I wanted to do some thing similar to this. But my case some what simple compare to yours.
Actually I have an animation with 3 frames, where only height and width of body shape will change from frame to frame. So is there a way through which I can change height and width of the shape directly? Instead of creating and destroying each time

Thanks,
Madhu.

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