CCPhysicsBody: switching body "type" when space is locked may assert unexpectedly
For example, try to change a static body's type to dynamic in a collision callback or other callback where chipmunk space is locked:
node.physicsBody.type = CCPhysicsBodyTypeDynamic;
node.physicsBody.affectedByGravity = YES;
This will assert that "Only dynamic bodies can be affected by gravity.". But hey, I just set this to dynamic, didn't I? Problem being that changing the type is deferred into a post-step block due to the locked space. Hence the body remains static for now, which triggers the assertion.
Glancing over the code I can see there are other combinations where asserts might be triggered unwittingly, or even property setters being ignored altogether (ie changing allowsRotation in the above scenario would be ignored).
I just probably reported the same / similar problem: http://forum.cocos2d-iphone.org/t/possible-bug-in-physics/13329 Test project here https://dl.dropboxusercontent.com/u/147970342/joints.spritebuilder.zip