I was doing some test stuff for a game that uses Box 2D flash. I found and learned a thing that i didn’t knew and it was very important. I had created a world with some bodies(polygons and circles) added to it. I was destroying and creating bodies just to play around. So when i was creating a body dynamically at runtime, i found out that body wasn’t getting created because world.CreateBody(bodyDef) was returning NULL. I was really surprised when i found this. I traced everything like if bodyDef and world was not null and all that. So i was looking through my code again and again to find why world.CreateBody was returning null. Then i was suspicious about something. So what i did something to confirm my suspicion that before creating a body i waited all body to sleep i.e when they are not moving or interacting. After all bodies were sleep i created a body and viola bingo bang boom my body was created. So my suspicion was true that when world is stepping then world.CreateBody always returned null (I tested it again and again). Hmnnnnnn so this was pretty interesting. I am still working around to find a solution for this as i haven’t find any very graceful good solution to create a body during world step. if you have any suggestion/tips or solution please do share.

Gracias