Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert UIKit coordinates to SpriteKit coordinates

I am trying to convert normal uikit coordinates (top left origin, width and height go right and down) to Sprite Kit coordinates (origin is at center of node, left and down are negative, right and up are positive).

Does anyone know how to do this? Unfortunately I can't work around this to my knowledge because I am using QuartzCore for drawing on a SKNode. Without converting, I am getting really off drawings.

like image 960
Kjell Connelly Avatar asked Nov 26 '14 20:11

Kjell Connelly


1 Answers

According to the docs, SKView has methods for Converting Between View and Scene Coordinates.

Remember the scene is itself an SKNode, so if you need to get from scene coordinates to a particular node coordinate system there's also the methods in Converting to and from the Node’s Coordinate System.

like image 192
rickster Avatar answered Sep 30 '22 19:09

rickster