Sprite Kit Physics Assertion failed: (typeA == b2_dynamicBody || typeB == b2_dynamicBody)

喜你入骨 提交于 2019-12-24 01:57:42

问题


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?

来源:https://stackoverflow.com/questions/20389450/sprite-kit-physics-assertion-failed-typea-b2-dynamicbody-typeb-b2-dyn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!