0
votes

I have following hierarchy:

Scene -> Root node -> NodeA -> NodeB (anchor node that's rotated) -> NodeC

how can I figure out visual position of NodeC in Root node coordinate space?

I've tried several variants with convertPoint:toNode: and convertPoint:fromNode: but numbers i'm getting don't match.

I've also looked at Get visible location of SpriteKit node after parent rotation, which seems to be close to my issue, but no luck there either.

1
What variants did you try, what results did you get, and what results did you expect?Mike S

1 Answers

0
votes

Found what I was missing - convertToPoint needs to be called from the node in which final CGPoint value will be represented in. So, this works:

// point is CGPointZero because it is center of NodeC

let point = rootNode.convertPoint(CGPointZero, fromNode: NodeC) as CGPoint!