Skip to content

Commit 4b1d95d

Browse files
committed
Remove kinetic nodes from kinetic update if its registered as such.
1 parent dce8781 commit 4b1d95d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cocos2d/CCPhysicsBody.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ -(void)setType:(CCPhysicsBodyType)type
272272
// Chipmunk body type cannot be changed from within a callback, need to make this safe.
273273
[space addPostStepBlock:^{_body.type = ToChipmunkBodyType[type];} key:self];
274274
} else {
275+
276+
if(self.type != type && self.type == CCPhysicsBodyTypeKinematic)
277+
{
278+
[self.node.physicsNode.kineticNodes removeObject:self.node];
279+
}
280+
275281
_body.type = ToChipmunkBodyType[type];
276282
}
277283
}

0 commit comments

Comments
 (0)