I am using the newest Xcode with Swift and SpriteKit.
In my GameviewController in viewDidLoad() I set the scene Anchor point to the middle.
scene.anchorPoint = CGPoint(x: 0.5, y: 0.5)
And I slapped a chessboard down in the center for all the devices.
Then for the individual squares I set the anchor point at 0,0. This makes setting up the squares programatically a snap! I wont go into a boring math explanation. But by centering the board and then dividing an individual squaresize by 8 you can quickly set up all the squares universally. It works.
A1.anchorPoint = CGPoint(x: 0,y: 0)
A1.anchorPoint = CGPoint(x: 0,y: 0)
So I did all this.
And set up the touch etc... but the when I picked up a chess piece and dropped it on a square, it was off by a small amount. The piece wouldn't drop on the left of the square and had an extended area on the right.
And this is what I don't understand.
And if anyone actually read all this, thanks. I am boring myself here... LOL.
But after two days of thinking, cursing Apple and it 'faulty' Xcode, and 'faulty' Swift, and broken touch on its iPads, I realized all I had to do was reset the anchorpoint to (x: 0.5, y: 0.5) in Touches Moved. After I moved the piece, I had to then change its anchor point it mid flight.
Now it drops directly into the square as it should.
But why?
Why would changing the ANCHOR POINT of a sprite during 'mid-pan' affect where the touches ended calculates its drop?
I just want to know.... If anyone read all this again thanks. I am so happy I figured it out. I was about to scrap the whole chess game, and all its subsequent sequels, and all my dreams were lost... LOL. But anyway, best of luck. And if anyone has an answer do tell.