I've got a really simple problem, but I've not been able to find a solution...how do I get the screen coordinates of a SKSpriteNode
, given that its position
property is CGPoint.zero
but that its a number of children down from the SKScene
and each parent will have applied some translation?
you'll want to use convert(_ point: CGPoint, to node: SKNode)
and convert(_ point: CGPoint, from node: SKNode)
you'll probably have to use both
example
let nestedSpritePos = convert(convert(nestedSpritePos.position, from: nestedSpritePos.parent!), to: self)
assuming self is the scene. You may have to play around with those but they definitely are what you are looking for.