I have implemented 3DTouch peek and pop actions in my game.
Essentially I have a MenuScene
and a GameScene
. In the MenuScene
I have 2 CollectionViewControllers
(world select and level select). I can use peek and pop from the world select menu to get a preview of the level select menu. Everything is working perfect however I have 1 problem.
When I use peek and pop in the MenuScene
and then transition to GameScene
to play my game the physics seems to be messed up. Apply impulse is very low so my player is only jumping about 1/5 the height he should.
Even increasing the impulse to adjust for this scenario is not working, the jump height always stays the same doesn't matter what value I use.
It also seems that applyForce
, which I use with core motion to move my player, is more sluggish.
What's strange is that it only seems to affect jumping. My code for shooting, which also uses an impulse, is still working fine.
It almost feels like that the player is heavier when I used peek and pop in the menu scene but I cannot see anything that would indicate so.
If I do not use peek and pop in the MenuScene
and just go to GameScene
I do not have this problem, everything is behaving as usual.
Steps I have tried so far to no avail.
Trying to unregister the preview delegate when I exit my
MenuScene
.unregisterForPreviewing(withContext: ...)
Adding the preview delegate directly to the world menu
CollectionViewController
, instead of adding it the rootviewcontroller
.Using console to print out my
GameScene
physics values to see if something is messed up.
Am I missing something? Why are peek and pop actions messing up SpriteKit physics?