Instance Method

nodesAtPoint:

Returns an array of all visible descendants that intersect a point.

Declaration

- (NSArray<SKNode *> *)nodesAtPoint:(CGPoint)p;

Parameters

p

A point in the node’s coordinate system.

Return Value

An array of all SKNode objects in the subtree that intersect the point. Only nodes that have an hidden of false and an alpha greater that zero are included in the returned array. If no nodes intersect the point, an empty array is returned.

Discussion

A point is considered to be in a node if it lies inside the rectangle returned by the calculateAccumulatedFrame method.

See Also

Hit Testing

Understanding Hit-Testing

Learn how find child nodes at a given point by using hit-testing.

- containsPoint:

Returns a Boolean value that indicates whether a point lies inside the parent’s coordinate system.

- nodeAtPoint:

Returns the deepest visible descendant that intersects a point.