Search code examples
swiftcocos2d-iphonesprite-kitphysics

Spritekit - Moving Physics world issue


I am building a tower stacking game. My structure is as follows:

  1. I have a world node which has a physics body attached to it.
  2. I add SKShapeNodes with physics bodies in it and they stack over one another.
  3. When a certain height is reached, I move the worldNode down.

Now here is where the problem occurs. When I move the worldNode down, it disturbs the already placed physics bodies and it makes the tower fall quite number of times.

Coming from a Cocos2D background, I used to move the whole scene there and it did not create any problem there.

Help will be appreciated. Thank you.


Solution

  • Instead of moving the world node you should move the SKCameraNode into the opposite direction.