开发者

Delay in destruction of box2d body.(cocos2d-iphone)

开发者 https://www.devze.com 2023-04-01 01:29 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号