SpriteKit Game Centre Force - ios

I'm creating an app and for some reason when I'm running the app on the device and the Welcome to Game Centre drop down appears, the force applied to my SKSpriteNode seems to be greater than normal, making my sprite fly off the screen.
So I add my sprite in the scene in the initWithSize method but then once you click on the screen, the touchesBegan fires which applies a force to the sprite, and if the Game Centre drop down doesn't appear (when you first start up the app) then it will work as per normal. Problem only seems to occur when Game Centre drop down appears.
Any ideas on a solution?

Related

How do I freeze an AR scene in ARKit and then restore the scene elsewhere - Swift, XCode

I have an AR scene (built as a node with children nodes) that I want the user to walk inside it.
Because it can be large, I added a pause button in the corner so that if the user hits an obstacle in the real world, he'll just need to press-and-hold that button to freeze the scene, move elsewhere in the real world, and when the button will be released the scene would have moved as-is to that new location, retaining the same relative position and rotation inside that scene.
What I did is very simple. When button is touched down I just did:
sceneView.session.pause()
And when the button is Touch Up Inside I ran:
sceneView.session.run(configuration)
This seemed to do the trick.
However, after I clicked and moved once or twice more and moved back to where I was before, my whole AR scene suddenly jumped back to its previous location in the real world. So it did freeze and showed up in the new location for a second or two, but then it jumped back.
I tried to resume the session with several of the available options.
If I ran:
sceneView.session.run(configuration, options: [.resetTracking])
the whole scene would move to the new location, but it would be set to its initial position and rotation as if I was standing at (0,0,0) when I started the app, but now moved to the new location. In other words, it lost the current location and rotation that I was at when I pressed the pause button and just reset the scene.
All the other options that I tried had the same effect as if I didn't add any options.
I should add that I'm not using any anchors (so far) nor any ray casting.
I didn't try different combinations of those options (except removeExistingAnchors and resetTracking together), but I doubt that that would help. Am I wrong?
What am I doing wrong?
Anyone have a solution for my problem?
Or will I need to manually record the current position and rotation when pressing the pause button and then restore those with some position change of the node? I was hoping I could skip having to do it this way.
And if I do need to do it manually, any tips on how to achieve this?
Thanks for your help!

How does the default SceneKit application in Xcode handle the double click?

When I open a game application in Xcode, and go to SceneKit there is already some code written. The code draws an airplane and allows the user to rotate it. When you double tap anywhere on the screen the plane returns to its original position. How can you do that. I looked through the whole application and there is no hint of a double tap gesture or bringing the view back to its position. How does that happen without any code?
There's no code there to allow you to rotate the plane either.
That functionality as well as the double tap to reset the camera functionality is added by the scnView.allowsCameraControl = YES line in the view controller.

How to receive a touch ended event if a finger is already touching the screen when the app loads

I need to track if the user is touching the screen across multiple views and separate screens throughout my app. I have already created a window delegate method to receive every type of touch event. The problem is that if I keep one finger on the first screen and tap a button with a separate finger that takes me to the second screen, when I release my original finger no event is fired.
This problem is the same if you were to hold your finger on the screen before the app loads and then release it once it's started, no event is fired for the touch ending.
I presume there is some in built system in iOS that states you have to start a new touch once the app has started or the screen/view has changed, so if you release a finger that was already touching nothing happens.
Is there a way to detect this? I really need to keep a constant accurate number of touches on the screen throughout the different screens/views within my app, especially if the user takes their finger(s) off the screen.

Swift SpriteKit: Recognize multiple taps

I have a game and at the moment there is an AI player and human but I want to make it multiplayer. The game is designed where when you press the top left/right the sprite on top would move left/right and if you press the lower left/right the lower sprite would move towards the left/right. Imagine the iPhone to always be in portrait mode.
The issue is that I am using touchesBegan and I can't figure out how to make that work with possible multiple taps coming in at the same time

Unity 3d 4.6b New GUI system doesn't take touch when already a touch event is occurring in 3d scene

I know this is beta version but..
I have a Canvas->Button which works fine when I tap it normally.
I have a joystick in my scene which is drawn by separate camera other than mainCamera.
now, while i am operating joystick without leaving it, if I tap on he Canvas->Button - it does not respond. When I lift finger from joystick and tap on it, it works fine.
Same goes for another Canvas->Toggle control.
It has something to do with the layering or anything else...I'm not sure?

Resources