简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM