change physics "shape" for a sprite after a "setSequence" on the sprite?

How can one change physics “shape” for a sprite after a “setSequence” on the sprite?

Background:  The sprite changes shape a bit depending on which animation they are undergoing.  Is there a way to change the physics shape for the sprite?   Was considering doing this when using “setSequence” to change the animation  (i.e. not for each frame change within an animation)…

Do I need to remove the physics body and re-add it as a last resort?  Is there a risk re doing this at all?

Check this: http://forums.coronalabs.com/topic/32726-physics-bodies-spritessequences-a-realistic-spring/?p=169704

The short of it is that you have two options:

One sprite sheet with physics bodies moved along with it, or

Separate sprite sheets for each physics body.

There’s probably other ways, but those are Brent’s suggestions. Get creative and let us know what you do.

thanks for the links - after reviewing I’m thinking the easiest still may be to:

-- my custom function for changing the animation function customSetSequence(mySprite, newPhysicsShape, sequenceName)   mySprite:setSequence(sequenceName)   physics.removeBody( mySprite )   physics.addBody( mySprite, { shape=newPhysicsShape } ) end

I’ll give this a try - hopefully adding/removing bodies mid-flight is ok…

well removing and then re-adding (addBody) gives really weird results for me - player starts dropping faster than I expect & when hits the ground and a ragdoll is created it bounds heaps more than before - only change was to remove/add the player body in flight so to speak…

Rather than removing the players body have you thought about simply creating multiple bodies and only enabling one of them at a time, using .isBodyActive ?

Check this: http://forums.coronalabs.com/topic/32726-physics-bodies-spritessequences-a-realistic-spring/?p=169704

The short of it is that you have two options:

One sprite sheet with physics bodies moved along with it, or

Separate sprite sheets for each physics body.

There’s probably other ways, but those are Brent’s suggestions. Get creative and let us know what you do.

thanks for the links - after reviewing I’m thinking the easiest still may be to:

-- my custom function for changing the animation function customSetSequence(mySprite, newPhysicsShape, sequenceName)   mySprite:setSequence(sequenceName)   physics.removeBody( mySprite )   physics.addBody( mySprite, { shape=newPhysicsShape } ) end

I’ll give this a try - hopefully adding/removing bodies mid-flight is ok…

well removing and then re-adding (addBody) gives really weird results for me - player starts dropping faster than I expect & when hits the ground and a ragdoll is created it bounds heaps more than before - only change was to remove/add the player body in flight so to speak…

Rather than removing the players body have you thought about simply creating multiple bodies and only enabling one of them at a time, using .isBodyActive ?

just getting back to this horacebury - noting this point is still causing my game to be not quite right - just noted your comment which is a good idea - I’ll try this and see how it goes -I’m guessing you meant create a 2nd invisible display object, tie it to the user display object (insert it perhaps), then add the 2nd “addBody” to this invisible one?   

just getting back to this horacebury - noting this point is still causing my game to be not quite right - just noted your comment which is a good idea - I’ll try this and see how it goes -I’m guessing you meant create a 2nd invisible display object, tie it to the user display object (insert it perhaps), then add the 2nd “addBody” to this invisible one?