I am trying to make a game with fully IOS 7 features using SpriteKit including Physics. So when user tabs to the screen, I am throwing a ball through some other balls (which are not moving and I set dynamic=NO
for these target balls). What I want to do is:
- Immadiately stop the ball (I am using
resting=YES
for this) - Switching categoryBitMask and contactTestBit mask from throwing ball to target ball's category / contactBitMask
- Stopping dynamics for this ball.
Everything is okay except one thing, when I am setting dynamic=NO
inside didBeginContact
(even any other functions like update
or didSimulatePhysics
) getting following error:
Assertion failed: (typeA == b2_dynamicBody || typeB == b2_dynamicBody), function SolveTOI, file /SourceCache/PhysicsKit_Sim/PhysicsKit-4.6/PhysicsKit/Box2D/Dynamics/b2World.cpp, line 670.
Alright I understand the reason 'cause calculations are still continuing about physics but somehow I have to set this.
So how can I stop dynamics programatically after collision / contact?