I just encountered this problem where I have a box2d body collide with another box2d body and one of the bodies on collision is supposed to be destroyed. The sprite gets removed all right and the body also gets destroyed but only after approximately 4 seconds.
Please if anyone has come across this type of proble开发者_运维技巧m I should be grateful if you could help me out on how to solve this riddle.
Thanks
Are you attempting to destroy the b2Body immediately.
It is incorrect to try and delete bodies during collision code as the collision would also be removed.
Instead, try queuing the body for deletion and delete it on your next update loop.
精彩评论