0
votes

I've implemented zooming by rescaling a root "world" node housing all the objects in my game. However, with the smaller size of the world node & children, applying forces now has a greater effect.

Even if I scale forces by the same scaling as my world node, they are still huge and objects go flying.

I've seen some pretty hectic solutions around:

  • Scale the scene (but then overlays are scaled too)
  • Create a whole new invisible layer that obeys normal physics then a visible layer on top which you scale...

Is there a more straightforward approach to somehow just scale the physics world with the world node?

1

1 Answers

1
votes

Yes, don't scale in order to zoom. Try resizing instead.

myScene.scaleMode = SKSceneScaleModeAspectFill;

And then while zooming:

myScene.size = CGSizeMake(myScene.size.width + dx, myScene.size.height + dy);

*Apple Documentation says:

Set the scaleMode property to SKSceneScaleModeResizeFill. Sprite Kit automatically resizes the scene so that it always matches the view’s size.