Search code examples
ioscocos2d-iphonesigabrtchipmunkspritebuilder

Attempting to deactivate a non-dynamic body


I am using Cocos2D 3.1 with SpriteBuilder and I am simply trying to get things working. I have set up my SpriteBuilder ccb with a physicsNode and put my physics objects within it.

In my app I then try to call this:

[_sprite.physicsBody applyImpulse:ccp(-95.0f, 2800.0f)];

All of a sudden, there is a SIGABRT and it crashes on this line in cpSpaceComponent.c:

cpAssertHard(cpBodyGetType(body) == CP_BODY_TYPE_DYNAMIC, "Internal error: Attempting to deactivate a non-dynamic body.");

Aborting due to Chipmunk error: Internal error: Attempting to deactivate a non-dynamic body. Failed condition: cpBodyGetType(body) == CP_BODY_TYPE_DYNAMIC

I have looked around and there is no documentation on this type of crash. I am not even sure where to begin to try to fix this. Does anyone know what I should do to fix this crash?


Solution

  • Fixed it. Turns out my CCPhysicsNode had a sleep time threshold of 0, once I set it to the normal .5, everything works fine.