Update physics - body size

I have an object with a given size (width, height).
I add this to physics using addBody.

After resizing this object, how should I update the body? I didn’t find any method removeBody or updateBody.

Should I remove the whole object and recreate it with the new size and then re-add it to physics?

Is this the best practice? This seems to be very time consuming. [import]uid: 28830 topic_id: 6505 reply_id: 306505[/import]

Anybody ? I really can’t find any solution [import]uid: 28830 topic_id: 6505 reply_id: 22577[/import]

yes you had it right [import]uid: 6645 topic_id: 6505 reply_id: 22775[/import]

But this won’t cause performance issues?

Thanks [import]uid: 28830 topic_id: 6505 reply_id: 22783[/import]

it;s the only way to do it because of the way box2d works. remove it in your collision/touch event, and add it again in your enterframe
[import]uid: 6645 topic_id: 6505 reply_id: 22784[/import]

Why do I have to add it again in the enterframe and not directly in the collision function, after I destroy it? [import]uid: 28830 topic_id: 6505 reply_id: 22787[/import]

it wont work. you cant change the world inside the box2d simulation “step”. do it in the enterframe [import]uid: 6645 topic_id: 6505 reply_id: 22850[/import]

Does Corona offer thread management ? EnterFrame is executed on a separate thread as I’ve seen and is quite difficult to synchronize all the actions without having thread synchronization (synchonized methods, join, sleep etc).

Changing my code to recreate the objects at enterFrame caused a lot of errors because I cannot synchronize correctly the order the methods are called.

Please help: Should I recreate my objects with their new body size in enterFrame? Why it does not work on events like “touch” ?
Is there any thread management in Corona ?

I’m creating a new topic for the question with the thread management since is not too related with the original question - body size. [import]uid: 28830 topic_id: 6505 reply_id: 23159[/import]

http://developer.anscamobile.com/forum/2010/10/14/adding-physics-body-inside-collision-event-handler-crashes-corona

http://developer.anscamobile.com/forum/2011/01/26/how-do-people-change-their-physics-body

http://developer.anscamobile.com/forum/2011/01/23/cant-add-body-new-spawn-image

http://jonbeebe.tumblr.com/post/2515495262/corona-collision-no-no [import]uid: 6645 topic_id: 6505 reply_id: 23188[/import]