Question

I am getting the following log when my game crashes due to a assertion failure.

 Assertion failed: (typeA == b2_dynamicBody || typeB ==b2_dynamicBody), function SolveTOI, file
/SourceCache/PhysicsKit/PhysicsKit-6.5.4/PhysicsKit/Box2D/Dynamics/b2World.cpp, line 678.

This happens intermittently (about once in 10 times I play the game). All I can get is that there is some inconsistency which occurs the Box2D engine related to the contact detection in the scene's physicsWorld. But I am not being able to pinpoint the cause of the problem in my code.

Can somebody tell me how to go about finding the root of this problem?

Was it helpful?

Solution

The assert indicates that both bodies are not dynamic.

Make sure you don't change the dynamic property of bodies to NO (use bitmasks to exclude them from colliding). Definitely don't do that within the contact callback methods because it looks like this assert happened during the contact collision solving step. It seems logical that two static bodies can only be in contact and trying to resolve collision when one of them was initially dynamic when contact began.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top