1

I'm making a boxing game where each boxer is made up of sprite nodes attached using physics joints. The game works well but very rarely when I run a long automated test (chaos monkey style) the joints get tangled up, tear and the game crashes.

Here is a video of it happening see at 0.18.

https://www.youtube.com/watch?v=aHrjBdjNILc

Any idea what can be the cause and how I can strengthen the code and fix this annoying bug? I've spent hours looking into this now and any hints highly appreciated.

Here is a sample code how I setup the joints:

SKPhysicsJointSliding* neck = [SKPhysicsJointSliding jointWithBodyA:body.physicsBody
                                                              bodyB:head.physicsBody
                                                             anchor:head.position
                                                               axis:CGVectorMake(head.frame.size.width, 0)];
neck.shouldEnableLimits = YES;
neck.lowerDistanceLimit = 0.0;
neck.upperDistanceLimit = head.frame.size.width / 2;
Fluidity
  • 3,985
  • 1
  • 13
  • 34
Alex
  • 23
  • 2
  • PS. There are no errors in the log, the game just crashes, the physics simulation is obviously working very hard because the frame rate drops to 1fps. – Alex Jul 29 '17 at 17:49

0 Answers0