Intersect Nodes ---- Objective-C - Swift - iOS - SpriteKit Node
ios, objective-c, sprite-kit, swift
Solution
I have the same problem when I try to intersects static node (that located left) with node that have rotation (and flying from the right side). I fix it like this
if ([ninja intersectsNode:node] &&
CGRectGetMinX(node.frame) <= CGRectGetMaxX(ninja.frame) &&
CGRectGetMaxX(node.frame) >= CGRectGetMinX(ninja.frame))
{
//and here I have intersects
}
So I fix it by adding additional parameters
Problem
I'm wondering why the following thing does not work correctly. Before the nodes are drawn, I analyze if two specific nodes intersect by using: ``` [[self playerSpriteNode] intersectsNode: [self pSKLabelNode]] ``` When pSKLabelNode touches desiredSpriteNode it works perfect! (By returning true, or false when it doesn't intersect) But when it "passes" by a few pixels away from the SKLabel it still intersects and returns true. Is there some setup that are recommended to fix the frame size of the nodes, or solutions that you think that will fix the problem?