I am currently working at a 2D endless runner in SpriteKit. I create new Level sequences using the Scene Editor and then add them as a SKReferenceNode to the main scene.
The problem is, that I need to get the position of the single nodes inside of the SKReferenceNode, but the ones I get, are relative to the SKReferenceNodes coordinate system and not the main one.
How can I get the position of the nodes relative to the main scene?
you'll want to use the convert func
func convert(_ point: CGPoint, to node: SKNode) -> CGPoint
Description
Converts a point in this node’s coordinate system to the coordinate system of another node in the node tree.Parameters
point - A point in this node’s coordinate system.node - Another node in the same node tree as this node.
Returns
The same point converted to the other node’s coordinate system.