-1

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?

4

1 回答 1

1

你会想要使用转换函数

func convert(_ point: CGPoint, to node: SKNode) -> CGPoint

描述
将此节点坐标系中的一个点转换为节点树中另一个节点的坐标系。

参数
point - 此节点坐标系中的一个点。

node - 与此节点相同的节点树中的另一个节点。

返回
同一个点转换到另一个节点的坐标系。

于 2018-01-27T19:58:33.570 回答