SKNode convertPoint toNode & fromNode confusion?

后端 未结 4 1863
遇见更好的自我
遇见更好的自我 2020-12-23 10:06

I am a little confused by how the SKNode methods convertPoint:fromNode: and convertPoint:ToNode: are working, I have looked at the doc

4条回答
  •  一向
    一向 (楼主)
    2020-12-23 10:31

    For simplicity: When comparing location of node B to node A (trying to find how far they are from each other)

    var BInSameCoordinateSys = NodeA.parent!.convertPoint(NodeB.position, fromNode: NodeB.parent!)
    

    Troubleshoot by adding a sprite at location if not working to help visualize the location:

    let childToSeeLocation = SKShapeNode(CircleWithRadius:50)
    childToSeeLocation.fillColor = UIColor.redColor
    ParentofA.addChild(childToSeeLocation)
    

提交回复
热议问题