I am trying to create a game with iOS 7 features using SpriteKit, including physics. Therefore, when the user clicks on the screen, I throw the ball through other balls (which do not move, and I set dynamic=NO for these target balls). I want to do this:
- Stop the ball directly (for this I use
resting=YES ) - Switching the BitMask category and TestBit contact mask from throwing the ball to the target ball / contact category BitMask
- The breakdown dynamics for this ball.
Everything is fine except for one when I set dynamic=NO inside didBeginContact (even any other functions like update or didSimulatePhysics ), getting the following error:
The statement failed: (typeA == b2_dynamicBody || typeB == b2_dynamicBody), SolveTOI function, file / SourceCache / PhysicsKit _Sim / PhysicsKit-4.6 / PhysicsKit / Box2D / Dynamics / bWWorld.cpp, line 670.
Well, I understand the reason why physics calculations are still ongoing, but somehow I have to establish this.
So, how can I stop the dynamics programmatically after a collision / contact?
source share