2

Assume nodeA is a child of nodeB. Changing the value of zRotation for nodeB effectively rotates nodeA, but nodeA's position (since it's relative to nodeB) remains the same.

Now assume nodeA is removed from nodeB, but its position remains fixed in the screen. nodeC is added to nodeB and rotated.

How can you detect overlap between nodeC and nodeA? containsPoint in SKNode, as described here, doesn't work since both nodeC and nodeA positions never change due to rotation.

Community
  • 1
  • 1
Crashalot
  • 33,605
  • 61
  • 269
  • 439

1 Answers1

2

You can tests nodes intersection with - (BOOL)intersectsNode:(SKNode *)node. But in this case nodes need to be in same node tree. Maybe you should not remove nodeA from nodeB before test?

Sergey Kuryanov
  • 6,114
  • 30
  • 52
  • when you say the same node tree, if they belong to the same parent, does that work? because then we could just remove nodea and nodec when testing for intersection and put them into a separate layer so they share the same parent. – Crashalot Apr 28 '15 at 21:06
  • I am not sure how it works exactly. May you please some example code to test? – Sergey Kuryanov Apr 28 '15 at 21:25