adding physics bodies in touch events?

i’ve been advising people not to use addBody inside a touch event so as the box2d “step” doesnt break, but it seems there has been some confusion here

eg check this example
http://mobile.tutsplus.com/tutorials/corona/corona-sdk_physics-engine_explosions

(but also notice my fix in the comments at the bottom)

he’s adding physics objects inside events there and it seems to work fine. now i know there are certain periods where you do not want to add bodies, and this has caused problem for people, but i’m no longer sure of the conditions where it is problematic

did ansca fix addBody to be “safe” re: the box2d world “step” function?

if people can notify me of any instances where they’re getting physics crashes with adding bodies inside of events etc i’ll take a look and see what the difference is

thanks
j
[import]uid: 6645 topic_id: 6679 reply_id: 306679[/import]

ah my bad. you should not use addBody inside collisions. in touch events it is fine.

sorry if i have given any bad advice :S mainly my responses have been regard simulator crashes during collisions though

j [import]uid: 6645 topic_id: 6679 reply_id: 23294[/import]