there seems to be a Cocos2dV3.4 display bug when adding lots of Chipmunk physics bodies quickly in the same spot in RELEASE MODE on a device. If the physics body is a rectangle its happens straight away, if it is a circle it takes longer but does happen. The key point is it always works fine in DEBUG mode but errors occur in RELEASE mode on the device. It always works fine in the simulator. (just Edit Scheme.. to change to release mode for RUN)
Example swift code to replicate. (simply add a dynamic polygon physics body at the same point quickly)
Code: Select all
class MainTestScene: CCNode
{
var _rootPhysicsNode : CCPhysicsNode!
var count : CCTime = 0
override init()
{
super.init()
_rootPhysicsNode = CCPhysicsNode()
_rootPhysicsNode.gravity = ccp(0,-100)
self.addChild(_rootPhysicsNode)
}
override func update(delta: CCTime)
{
count += delta
if count > 0.2
{
count = 0
for var i = 0; i <= 10 ; i++
{
let item = CCSprite(imageNamed: "ccbResources/rainbowblinky.png")
item.anchorPoint = ccp(0.5,0.5)
item.scale = 0.3
item.position = ccp(CCDirector.sharedDirector().viewSize().width / 2, CCDirector.sharedDirector().viewSize().height / 2 )
item.physicsBody = CCPhysicsBody(rect: CGRectMake(0, 0, 100, 100), cornerRadius: 1)
_rootPhysicsNode.addChild(item)
}
}
}
}
Can anyone help?