how to get a screen postion for child node

i have a node,but it have many parent node,now i want to get the node’s drawed postion,how do I get??

i have write a recursion algorithm,it will addition all parent’s postion offset and the node’s postion,but the result position is not right,have other people come across this problem??

You have to first remove the child from the parent & then convert it into worldSpace position & then into NodeSpace & then again addChild to the current layer. Then you will have the screen position, right know its in sprite’s localPosition space.

Really no need in removing node. Simply call parent~~>convertToWorldSpace) or parent~~>convertToWorldSpaceAR(node->getPosition()) depending on is your parent node anchor-relative.

1 Like