If by “viewing coordinates” you understand the coordinates of the scene, then check out this quick solution, which I use:
extension SKNode {
var positionInScene:CGPoint? {
if let scene = scene, let parent = parent {
return parent.convert(position, to:scene)
} else {
return nil
}
}
}
Then you can get the scene position in the same way as a regular position. Here is an example:
let positionInParent = childNode.position
let positionInScene = childNode.positionInScene? //optional return type
, positionInScene , SKNode , node . . , node , .