Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 730
blitzeus Avatar asked Feb 18 '14 21:02

blitzeus


1 Answers

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.

like image 157
rickster Avatar answered Sep 28 '22 08:09

rickster