blitzeus blitzeus - 3 years ago 159
iOS Question

iOS spriteKit child nodes position with respect to view coordinates

I have a child node added to another node. I want to get the child nodes position with respect to the views coordinates and not the parent nodes coordinates

Answer Source

Get the child node's position with respect to its parent, then use the convertPoint:fromNode: or convertPoint:toNode: method to convert from the parent node's coordinate system to the scene's coordinate system. (Remember, SKScene inherits from SKNode and is the root of the node hierarchy, so you can use it with either of those methods.) If you then need to work in the UIKit view coordinate space, use the scene's convertPointToView: method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download