I'm a fairly new app dev and very new to Sprite Kit. I am creating a game where I want a ball to always fall downward as if it were in gravity. This is just a 2d app so all I want is when the ball is falling, when you tilt the phone to the left, the ball travels down and left onscreen and if you tilt the phone to the right, the ball travels down and right onscreen. To give a better picture of what I want I made a quick diagram in photoshop:
I would just like some opinions on which is the easiest and best way to do this. My first thought was record the yaw and use it to dictate how far the ball travels left or right. This would require some calculations to get the ball to fall perfectly at 90 degrees and although it sounds possible to me, I'm not sure if it is actually possible.
Does anybody think this is the way to do it or is there a better way to this?
A problem I came across when trying out my first idea was when I tilt the phone, the ball moved left and right (without any proper calculations, so it was entirely inaccurate), I would tilt the phone to the left (for example) and the further I tilted it, the less sensitive it became, so the ball would travel left less. This would prevent my idea from working and I'm not sure if there's a way around it.
A bigger problem I encountered was when I swivelled around in my seat, the yaw would change too! I assume this has something to do with the compass since neither the roll or pitch changed as I did this. I'm sure something can be done to correct this because I never have this problem with games I play that use the gyroscope. If somebody could point me in the right direction with that, I'd be grateful, or I might just ask it in a separate new question. Below is another diagram I quickly drew up in photoshop to help with explaining the problem. Diagram 1 is the way I want to be able to tilt the phone but when you turn around (diagram 2) the ball moves left or right depending on how far you turn. (Yes, that is meant to be a person holding the phone in diagram 2)
Help would be greatly appreciated!