Search code examples
cocos2d-xbox2d

box2d crush on SetActive


I'm writing a game on cocos2d-x with box2d physics, I'm disabling some fixtures when they go off the screen.

But I got this error:

Assertion failed: (m_world->IsLocked() == false), function SetActive

while I'm doing this:

_physicsBody->SetActive(false);

anyone knows what's happening?


Solution

  • Thanks all who replied, you have helped me.. so everybody with this problem you have to just mark your nodes as dirty or something and then on update you can do whatever you would like to do with your bodies. Thanks.